我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
当前回答
去建造。Gradle(项目:xyz)
buildscript {
repositories {
jcenter()
google()
}
allprojects {
repositories {
jcenter()
google()
}
// Just place 'google()' to the top of 'jcenter()'
buildscript {
repositories {
google()
jcenter()
}
allprojects {
repositories {
google()
jcenter()
// enter code here
}
}
它非常适合我。
其他回答
在我的案例中,AndroidManifest.xml中有一个打印错误,如下所示。删除应用程序标签上方的“o”字母就解决了这个问题。
显然,Android Studio不会检测AndroidMainfest.xml中的类型错误
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
o
<application android:name=".AppName"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar">
使用菜单文件→无效缓存/重启…
然后重启机器(PC,笔记本电脑等)
如果你正在开发一个小部件应用程序,这个解决方案应该适合你:
进入编辑配置 将启动选项设置为Nothing
如果你的应用有一个默认的启动活动,这可能是你的错误:
步骤1:选择“编辑配置”
步骤2:注意这个警告:未找到默认活动
第三步:选择一个默认活动
步骤3:保存更改并完成
祝你好运
正确的方法是将以下内容添加到Manifest文件中:
<activity
android:name="FULL_NAME_OF_YOUR_ACTIVITY"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
这应该插入到:
<application> </application>
不需要使缓存无效。