简体   繁体   中英

Kotlin on android: Cannot find main merged manifest. What is causing this error?

I wanted to give Kotlin a shot. I converted my java classes to Kotlin and corrected some errors. If I try to build, the following error comes up:

Error:Execution failed for task ':app:generateDebugInstantRunAppInfo'. Cannot find main merged manifest.

This is the manifest file:

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

    <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=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="adjustPan">

        </activity>
        <activity android:name=".Setup_Activity"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

Thanks for your help!

I've been experimenting with Kotlin development in the just-released Android Studio 3.0 Canary 1 and get the “Cannot find merged manifest” error every now and again. I've found that selecting Build -> Clean Project solves the problem for me.

Clean Project适用于Android Studio 3.0 canary版本

在我的情况下,我正在使用Android studio 3.0 Canary 2,首先我尝试Build - > Clean Project仍然没有为我解决问题,然后我关闭项目并再次打开它,Alhamdulillah它解决了这个问题

I tried both cleaning the project and close-opening it, but they don't work in my case. After editing the manifest (not a functional change) now project runs.

Because Build -> Clean Project , restarting Android Studio or reinstalling app may not work, the simplest solution was to change AndroidManifest.xml, eg add or delete white space.

Here is reported issue: https://issuetracker.google.com/issues/62336754 .

As mentioned there, it will be fixed in Android Gradle Plugin 3.0.0-alpha5 .

您可以通过卸载当前正在使用的应用并在Android Studio上再次运行来解决此问题。

Tried the given solutions but wasn't successful. So for the mean time until this bug gets fixed I am going for the commandline

./gradlew clean install<your_build_variant>

Example:

./gradlew clean installDevDebug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM