我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
我把IntelliJ IDEA从12.0.4升级到12.10。
现在我的Android项目中的所有模块都给出了错误:
错误:没有找到默认活动
我恢复到12.0.4,一切都恢复正常了。
什么好主意吗?我认为这可能是一个丢失插件的问题。由于插件没有安装,它无法找到默认活动。另一个东西可能是本地配置,但我对此表示怀疑。我删除了配置文件夹来验证,这没有改变任何东西。
当前回答
Android Studio 4.1解决了这个问题
其他回答
只是清理和重建。问题就会消失。
我一直在Android Studio 3.0.1遇到这个问题,这是由明显的合并失败引起的。由于某种原因,我在消息输出中没有得到任何错误消息。我必须检查合并清单(app→清单→*AndroidManifest.xml,然后是“合并清单”选项卡)。
在底部有一个错误,指示在构建中添加的最新库。gradle文件,有一个依赖于其他一些库,其minSdk高于我的应用程序minSdk。解决方案就在这条信息里,就是添加
<uses-sdk tools:overrideLibrary="timber.log"/>
AndroidManifest.xml。实际上,这个库(piwik 1.0.2)在其manifest中已经有了这个overrideLibrary。
奇怪的是,其他团队成员并没有遇到这个问题。
在Android Studio中运行/调试配置-> Android应用程序->通用->活动->选择“不启动活动”选项。
有时卸载所有用户的应用程序会有所帮助。
进入“设置”中的“应用程序”列表。转到你的应用程序或滚动到列表的末尾,然后卸载它。
虽然很丑,但对我很管用:
我有这个错误消息,我的问题是在一个模块。我只是删除了应用程序标签完全从我的模块的清单和它工作。
(同时从模块库中删除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>