我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
当前回答
虽然很丑,但对我很管用:
我有这个错误消息,我的问题是在一个模块。我只是删除了应用程序标签完全从我的模块的清单和它工作。
(同时从模块库中删除ic_launcher。)
它是:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mymodule"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name="com.example.mymodule.MainActivity"
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>
</manifest>
Now:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mymodule"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23"/>
</manifest>
其他回答
在我的情况下,菜单文件→无效缓存/重新启动…没有帮助。
我的项目一切正常,当然我的活动有以下意图过滤器:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
真正帮助我的是删除Android/Gradle缓存文件夹(它们可以增长到10- 30gb)。
进入C:\Users\YOUR_USER_WINDOWS_NAME并删除以下文件夹
.android .AndroidStudio3.2 .gradle
(如果你想删除它,你可以在删除它之前保存一些Android配置。androidstudio3.2。)
用Gradle文件同步项目有时是有效的。
要解决这个整体问题,你应该:
退出Android Studio 进入USER文件夹→AndroidStudio→系统→缓存 删除该文件夹 启动Android Studio。
它将重新索引您的文件,这应该工作。
感谢kirtan403的类似问题。
去建造。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
}
}
它非常适合我。
使用菜单文件→无效缓存/重启…
然后重启机器(PC,笔记本电脑等)
尝试右键单击项目并选择打开模块设置。然后转到模块中的Sources选项卡,找到src文件夹,右键单击并将其标记为Sources(蓝色)。
在Android Studio的后期版本中没有源代码选项卡,但您可以编辑构建。如何在Android Studio中添加一个链接源文件夹?