我把IntelliJ IDEA从12.0.4升级到12.10。

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

错误:没有找到默认活动

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

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


当前回答

有时会出现这种错误,因为Android Studio的错误行为,因为内部缓存和项目构建系统。即使我们已经为默认活动完美地设置了一切。

对于这样的问题,我找到了一个解决方案,它是为我工作。

步骤1。Android Studio→菜单文件→无效缓存,关闭Android Studio。

步骤2。进入路径C:\Users\USER.AndroidStudio3.2\system

步骤3。更改名称扩展为下面文件夹的.back

  Example: compiler should be *compiler.back*

编译器 compiler-server 转换 external-build_system 框架 gradle resource_folder_cache

步骤4:启动Android Studio并打开项目。

其他回答

有时会出现这种错误,因为Android Studio的错误行为,因为内部缓存和项目构建系统。即使我们已经为默认活动完美地设置了一切。

对于这样的问题,我找到了一个解决方案,它是为我工作。

步骤1。Android Studio→菜单文件→无效缓存,关闭Android Studio。

步骤2。进入路径C:\Users\USER.AndroidStudio3.2\system

步骤3。更改名称扩展为下面文件夹的.back

  Example: compiler should be *compiler.back*

编译器 compiler-server 转换 external-build_system 框架 gradle resource_folder_cache

步骤4:启动Android Studio并打开项目。

我在不同的场景中得到了相同/类似的错误,错误:默认活动未找到,并且无法运行项目。

我发现我的项目有minSdkVersion=16。但是,其中一个包需要minSdkVersion >= 21。我更新了依赖项并重新构建。然后我又能运行这个项目了。

我使用Android Studio 4.0.1

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"/>

在我的案例中发生了这种情况,因为有一个明显的合并错误,我试图运行应用程序。

通过运行Build→Make Project查看具体的错误。

我有这个问题两天了。我尝试了所有可能的解决办法,但都没用。最后,我找到了一个解决方案。

以下是你需要做的:

关闭Android Studio 转到c:\ users \ username将build-cache文件夹重命名为build-cache.bak 进入C:\Users\UserName.AndroidStudio3.3\system并重命名这些文件夹 缓存到cache .bak 编译-server到编译-server.bak 把蝙蝠 转换到Conversion .bak External_build_system到External_build_system .bak Frameworks到Frameworks .bak Gradle到Gradle .bak Resource_folder_cache到Resource_folder_cache .bak 打开Android Studio,再次打开你的项目。