我把IntelliJ IDEA从12.0.4升级到12.10。

现在我的Android项目中的所有模块都给出了错误:

错误:没有找到默认活动

我恢复到12.0.4,一切都恢复正常了。

什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。


当前回答

这仍然发生在Android Studio 4.0,所以我必须删除以下文件夹来解决这个问题:

C:\Users\ my_user_name.AndroidStudio4.0 \ system \缓存

其他回答

我将Intent-filter改为

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

只需要添加DEFAULT选项。我正在使用Process Phoenix库,它提示我定义一个默认意图。这就解决了我的问题。

没有一个答案对我有用。错误信息说:

无法从../path/读取清单到/the/apk 没有发现默认活动

这个错误告诉我,Android Studio正在读取以前构建的APK文件。因此,我做了。/gradlew清洁来摆脱文件夹,这为我解决了问题。

去建造。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
    }
}

它非常适合我。

进入清单→合并清单标签(屏幕底部)。

在右边的面板中,如果有任何错误,请解决它!

这就是我的解决方案(一个工具错误:不需要替换)。

TL; diana:

确保您不仅检查操作和类别名称,还检查路径。特别是如果你做了重构。

我的解决方案是仔细检查AndroidManifest文件。我做了一个重构,它不仅更新了意图过滤器,而且还更新了意图过滤器名称的路径:

<!-- Type and value were added to the 
     path here when I did the refactor -->
<action android:name="android.intent.type.MAIN"/>
<category android:name="android.intent.value.LAUNCHER"/>

它应该是:

<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>