我把IntelliJ IDEA从12.0.4升级到12.10。

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

错误:没有找到默认活动

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

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


当前回答

编辑文件androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.java2">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivityName">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

其他回答

添加包= " your.package。Path解决了这个问题。我不知道为什么。我必须创建一个新的示例flutter项目,并将配置文件与我的配置文件进行比较才能找到这一点。

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abc.app">...</manifest>

如果您已经有<intent-filter>标记,请确保您正确地关闭了所有标记。

我的错误是我用</>而不是</activity>关闭了<activity>标签。

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

它非常适合我。

退出Android Studio。

进入路径C:\Users\YOUR_WINDOW_USER_NAME.AndroidStudio3.3\system

删除“/ cached”文件夹和“/tmp”文件夹。

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

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

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