Gradle: Execution failed for task ':processDebugManifest'

∥☆過路亽.° 提交于 2019-11-26 11:12:46
Lukas Olsen

Found the solution to this problem:

gradle assemble -info gave me the hint that the Manifests have different SDK Versions and cannot be merged.

I needed to edit my Manifests and build.gradle file and everything worked again.


To be clear you need to edit the uses-sdk in the AndroidManifest.xml

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

and the android section, particularly minSdkVersion and targetSdkVersion in the build.gradle file

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}

In a general way, to see what is the error, you can see the merged Manifest File in Android studio

Go on your manifest file

Click on the bottom tab "Merged Manifest"

On the right screen, in "Other Manifest Files", check for any error due to graddle :

vinaykumar

I wish the Lukas Olsen solution works for other scenarios, But in my case is quite different.

I faced the same while add ActionBarShelock to project, by comparing to the older library I found that application tag is missing in manifest. By adding one line I fixed my issue.

</application>

This appears to occur because Google Play Services require Android 2.2, which is SDK version 8.

In build.gradle, make sure your minSdkVersion is at least 8. The default appears to be 7. So you have something like this:

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }
}

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile 'com.google.android.gms:play-services:3.1.36'
}

i solved by putting this one line in application tag...

tools:node="replace"

I also faced this error when I was adding firebase push notifications in my app. but in my case I was doing a very silly mistake which i noticed after some time. I declared below code in manifest two times. After removing duplicate declaration. my issue solved.

        <service   android:name="com.evampsaanga.mytelenor.firebase.MyFirebaseInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>`

so you also check if there is anything duplicate in your app manifest file.

Maybe it's because of duplicate Activity declaration in your manifest.

If you add dependencies such as ActionBarSherlock by Gradle,
carefully set your targetSdkVersion 17 or above.

Below quote is --info logs when ActionBarSherlock mismatch with private project.

[C:\Me\Documents\GitHub\project\AndroidManifest.xml:3, C:\Me\Documents\GitHub\project\build\exploded-bundles\ComActionbarsherlockActionbarsherlock440.aar\AndroidManifest.xml:2] Main manifest has but library uses targetSdkVersion='17'
:testApp:processDebugManifest FAILED

It would be better that maintains own project targetSdkVersion as newest as possible.

I came across the same problem and what I did to fix it was to add

tools:replace="android:icon"

to element at AndroidManifest to override

It could be a duplicate permission added in the manifest file. In my case "uses-permission android:name="android.permission.READ_PHONE_STATE" was repeated.

For what I can see, if you have a multi-module project with Android Studio and gradle, the IDE try to merge manifest files from every module into a Main manifest.

If you have a module A and a module B, and in the A manifest you declare some activity from B module, gradle will enconter a issue when merging.

Try removing cross-module reference in manifest files.

I had the same problem and none of the other answers helped.

In my case, a comment in the manifest file was the culprit:

<manifest [...]
    android:installLocation="auto">
    <!-- change installLocation back to external after test -->

    <uses-sdk [...]

(This might be a bug, seeing how comments in other areas of the manifest dont cause any problems.)

I came across similar problem ,when I run

cordova build android

which report errors:

 /home/app/phonegap/helloworld/platforms/android/AndroidManifest.xml:15:5 Error:
uses-sdk:minSdkVersion 7 cannot be smaller than version 10 declared in library  /home/app/phonegap/helloworld/platforms/android/build/intermediates/exploded-aar/android/CordovaLib/unspecified/debug/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usage

:processDebugManifest FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processDebugManifest'.

    Manifest merger failed : uses-sdk:minSdkVersion 7 cannot be smaller than version 10 declared in library /home/app/phonegap/helloworld/platforms/android/build/intermediates/exploded-aar/android/CordovaLib/unspecified/debug/AndroidManifest.xml Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usage

In my case,

uses-sdk:minSdkVersion 7 cannot be smaller than version 10 declared

,above solution do not work! but I solve them by replace

<preference name="android-minSdkVersion" value="7" />

as

<preference name="android-minSdkVersion" value="10" />

in this two file /home/app/phonegap/helloworld/config.xml , /home/app/phonegap/helloworld/platforms/android/res/xml/config.xml

In my case,

I define the activity twice in manifest file

 <application
  android:allowBackup="false"
  android:label="@string/app_name"
  >


      <activity
        android:name="com.xxx.ActivityOne"
        android:configChanges="orientation|screenSize"
        android:windowSoftInputMode="stateHidden|adjustResize" />

      //Problem here.. same activity twice define

      <activity
        android:name="com.xxx.ActivityOne"
        android:configChanges="orientation|screenSize"
        android:windowSoftInputMode="stateHidden|adjustResize" />

     </application>

After remove the duplicate error solved.

Try changing:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

To:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
...
<uses-sdk xmlns:tools="http://schemas.android.com/tools"
    android:minSdkVersion="14" android:targetSdkVersion="16" />

if you are using android studio you should run the android studio through the command prompt(in windows) or terminal(in UNIX base OS) so you can see more detail about this error in command prompt window.

Found another possible solution for this when trying to update my Urban Airship to the latest version. In my top-level build.gradle file the code looked like:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

by default as generated by Android Studio. I changed this to a later gradle version by replacing this with:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.+'
    }
}

And after that the project would build.

In my case, it was because of duplicate permission in my Manifest file and minSDKVersion of library was greater than minSDKVersion of my project. I just made that minSDKVersion equal and compiled with success.

Keith Davis

2 things you need to add to AndroidManifest.xml:

1st: add xmlns:tools="http://schemas.android.com/tools" to manifest tag

<manifest xmlns:android=".........
   package="...........
   xmlns:tools="http://schemas.android.com/tools">

2nd: Add tools:replace="icon" to application tag

<application
       android:icon=.........
       android:label=.......
       tools:replace="icon">

This Issue is raise because of compileSdkVersion 26 buildToolsVersion "26.0.0" or compile 'com.android.support:appcompat-v7:26.+'

instead of this use compileSdkVersion 25 buildToolsVersion "25.0.3" compile 'com.android.support:appcompat-v7:25.+'

I had these error since I didnt have the required SDK version installed. After downloading and installing the SDK version present in build.gradle/Android Manifest file, it got resolved.

I met the problem in another reason.

I was building app in Android Studio, and I had a app module and another module. App module depended on the other module.

But part of build.gradle of app module is :

<application
    android:allowBackup="false"
    android:label="@string/app_name"
    android:supportsRtl="true">

    ...

</application>

while the other module's build.gradle part is:

<application
    android:allowBackup="true"
    android:label="Android Lua"
    android:supportsRtl="true">

</application>

So, I change the module's build.gradle part to:

<application
    android:allowBackup="false"
    android:label="@string/app_name"
    android:supportsRtl="true">

</application>

Problem solved.

Duplication declaration of same activity in Android Manifest file.

Andrea Leganza

In my case I had into the manifest file an invalid tag structure, I had an opened activity closed but inside it where were ore activities (...) which invalidates file correctness, to find it it took quite two hours, error reported missing/unknown <activity>.

Samridhi Dev
compile 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.1'

If this is the dependency you have added then change it to:

compile 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.4'

and make sure that target sdk should not be less then 15.

In my case I had written the tag twice. That was my only mistake It was before code`

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <uses-permission android:name="android.permission.RECORD_AUDIO"/>


<application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/react_native_config" />




<application application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/react_native_config" >

</application>

`

Just removing the application tag solved my problem.

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

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>



    <application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/react_native_config" />



</manifest>

The points you should have only one tag; can have more than one and , but one tag. That's what I know at this moment :)

Maybe you have some duplicated Activities

Like this:

<activity android:name=".register.RegisterStepsActivity" />

....

<activity android:name=".register.RegisterStepsActivity" />

just comment one of them

This error might be because of an attribute left empty in the manifest file.

An example:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:logo="@drawable/ic_actionbar"
    android:supportsRtl="true"
    android:fullBackupContent="">
...
</application>

The fullBackupContent is empty in the above example.

When it's changed to android:fullBackupContent="true" it will be fixed.

Just add these two lines at "gradle.properties":

android.useAndroidX=true
android.enableJetifier=true

In my context I removed the comment in manifest.xml and it worked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!