Error manifest merger failed with multiple errors see logs

So, I am a beginner into Android and Java. I just began learning. While I was experimenting with Intent today, I incurred an error. Error:Execution failed for task ':app:processDebugManifest'. >

So, I am a beginner into Android and Java. I just began learning. While I was experimenting with Intent today, I incurred an error.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

I found some solutions here and tried to implement them, but it did not work.

This is my build.gradle :

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.0"

defaultConfig {
    applicationId "com.example.rohan.petadoptionthing"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}

This is my AndroidManifest :

<?xml version="1.0" encoding="utf-8"?>
package="com.example.rohan.petadoptionthing" >

<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".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>

    <activity android:name=".Second"
        />

    <activity android:name=".third"/>
    <activity android:name=".MainActivity"/>


</application>

This is my first week with coding, I am sorry if this is a really silly thing. I am really new to this and did not find any other place to ask. Sorry if I broke any rules

Manifest merger failed with multiple errors is a common problem in android development. In this post, I will tell you what is the reason behind that, What necessary change you have to do to fix it in your project.

When manifest merger failed problem occur

  • You have created a project with appcompat and design lib, now trying to add material io dependencies in the same project. That time you mostly faced Manifest merger failed with multiple errors problem.
  • Another scenario is you have created a project with androidx and trying to add design, support lib than same problem will occur.

Somethings like below

dependencies {
    //...
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    
    // materail io
    implementation 'com.google.android.material:material:1.0.0'
  
 }  

Why manifest merger failed problem occur

It happened because we should not use the com.android.support and com.google.android.material  dependencies in the app at the same time

AndroidX

As you know we have used Android Support Library for providing backward compatibility last 7 years. Over the years, this library has grown in adoption as the majority of apps.

However, it hasn’t always been straight-forward, Overtime Support Library complexity was increasing day by day. So the Android team decided to refactor and combined the Support Library into a new set of extension libraries known as AndroidX.

 Google launched the new Android extension libraries called AndroidX in May 2018. This includes simplified and well define package names to better indicate each package’s content and it’s also supported API levels. This has provided a clear separation from what packages are bundled with Android OS, and those that are an extension of it.

I’m delighted to bring you initial support for AndroidX packages today.

Artifact Mappings AndroidX

AndroidX is a redesign of the Android Support Library, then how do you know what new library has and what is new name. Basically, Google made a great mapping of the original support library API packages into the androidx namespace. Only the package and dependency names changed, class, method, and field names did not change.

Package Name Change

Old New
android.support.** androidx.@
android.design.** com.google.android.material.@
android.support.test.** androidx.test.@
android.arch.** androidx.@
android.arch.persistence.room.** androidx.room.@
android.arch.persistence.** androidx.sqlite.@

For more details read official, see the following documentation.

How to resolve manifest merger failed problem

You saw the android team is redesigned the support library to androidx. Let’s see your project, If you are using androidx, than remove support and design library nd add material library. Now build the app and see all things working fine now

Create a new New Project with AndroidX

Now I’m going to demonstrate how to build a project with androidx and material io. Let’s move to Android Studio and create a new project with androidx.

Add the dependency in app gradle
dependencies {
    implementation 'androidx.appcompat:appcompat:1.0.2'
    // materail io
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 
}

Now sync and rebuild our project. You see there is no error with sync. But build finished with some compilation error. That’s because we are using import from now unknown library (android.support)

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
Let replace all import with androidX
//import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

Nice! All Done!

Go to resource layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    >
  <android.support.v7.widget.CardView
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:layout_marginBottom="16dp"
      android:layout_marginEnd="16dp"
      android:layout_marginLeft="16dp"
      android:layout_marginRight="16dp"
      android:layout_marginStart="16dp"
      android:layout_marginTop="16dp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      >
    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />
  </android.support.v7.widget.CardView>

</android.support.constraint.ConstraintLayout>

Now see here we are using support library component, So need to change in androidx

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    >
  <androidx.cardview.widget.CardView
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:layout_marginBottom="16dp"
      android:layout_marginEnd="16dp"
      android:layout_marginLeft="16dp"
      android:layout_marginRight="16dp"
      android:layout_marginStart="16dp"
      android:layout_marginTop="16dp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      >
    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />
  </androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>

Rebuild your project and run the application, you see your app is up and running.

Conclusion

In this post, we set up a new project with AndroidX)that replaces one package from the android support library. We also added new design library from google to support material io and now you can use any component of design in our project

Keep in touch

If you want to keep in touch and get an email when I write new blog posts, follow me on facebook or subscribe usIt only takes about 10 seconds to register. 

Still, if you have any queries please put your comment below.

An Android Studio project generally contains more than one Android Manifest.xml file. They are provided by the main sources set, imported libraries, and build variants. However, we know that the Android App Bundle file can contain only one AndroidManifest.xml file. So, the Gradle build merges all these manifest files into a single file. This process is carried out while building the application.

What is Manifest Merger?

The manifest merger tool plays an important role in combining all XML elements from each file. It follows merge heuristics and obeys all the merge preferences with special XML attributes defined by the user. The job of the merger tool is to logically match all the XML elements in one manifest with their respective elements in other manifests.

What is Merge Conflict?

A merge conflict occurs while merging whenever the value of any attribute is different in the two Manifest files. However, if an element from the lower-priority manifest does not match any elements in the high-priority manifest, then it is added to the merged manifest. And, if there is a matching element, then the merger tool combines all attributes from each into the same element.

Note: Use the Merged Manifest view to preview the results of your merged manifest and find conflict errors.

How to Resolve Merge Conflict?

Sometimes, it is possible that the higher-priority manifest is dependent on the default value of an attribute, but this value is not declared in the file. As all the unique elements are combined into the same element, a Merge Conflict may occur. Therefore, it is advisable not to be dependent on the default attribute values. For an instance, if the higher priority manifest uses “standard” as the default value for the android:launchMode attribute, without declaring it in the file and the lower-priority manifest assigns a different value to the same attribute, that value overrides the default value. Hence, it is applied to the merged manifest file. Therefore, the value of each attribute should be explicitly defined as per requirement. 

Note: Default values for each attribute are documented in the Manifest reference.

Merge Rule Markers

These are XML attributes that can be used to express the user’s preference about how to solve merge conflicts or remove unnecessary elements and attributes. A marker can be applied to either an entire element or to a specific attribute. When merging two manifest files, the merger tool looks for these markers in the higher-priority manifest file. All markers belong to the Android tools namespace. Hence, they must be declared in the <manifest> element as shown:

XML

Node Markers

To apply a merge rule to an entire XML element (to all attributes in a given manifest element and to all its child tags), use the following attributes:

  1. tools:node=”merge”: Merge all attributes in this tag and all nested elements when there are no conflicts using the merge conflict heuristics. This is the default behavior for elements.
  2. tools:node=”merge-only-attributes”: Merge attributes in this tag only; do not merge nested elements.
  3. tools:node=”remove”: Remove this element from the merged manifest. Although it seems like you should instead just delete this element, using this is necessary when you discover an element in your merged manifest that you don’t need, and it was provided by a lower-priority manifest file that’s out of your control (such as an imported library).
  4. tools:node=”removeAll”: Like tools:node=”remove”, but it removes all elements matching this element type (within the same parent element).
  5. tools:node=”replace”: Replace the lower-priority element completely. That is, if there is a matching element in the lower-priority manifest, ignore it and use this element exactly as it appears in this manifest.
  6. tools:node=”strict”: Generate a build failure any time this element in the lower-priority manifest does not exactly match it in the higher-priority manifest (unless resolved by other merge rule markers). This overrides the merge conflict heuristics. For example, if the lower-priority manifest simply includes an extra attribute, the build fails (whereas the default behavior adds the extra attribute to the merged manifest).

This creates a manifest merge error. The two manifest elements cannot differ at all in strict mode. So you must apply other merge rule markers to resolve these differences.

Note: For app modules, tools merge markers are removed after the merge; however, for library modules, tools merge markers are not removed after the merge and may affect merges in a downstream module.

Attribute Markers

Instead, apply a merge rule only to specific attributes in a manifest tag, use the following attributes. Each attribute accepts one or more attribute names (including the attribute namespace), separated by commas.

  1. tools:remove=”attr, …”: Remove the specified attributes from the merged manifest. Although it seems like you could instead just delete these attributes, it’s necessary to use this when the lower-priority manifest file does include these attributes and you want to ensure they do not go into the merged manifest.
  2. tools:replace=”attr, …”: Replace the specified attributes in the lower-priority manifest with those from this manifest. In other words, always keep the higher-priority manifest’s values.
  3. tools:strict=”attr, …”: Generate a build failure any time these attributes in the lower-priority manifest do not exactly match them in the higher-priority manifest. This is the default behavior for all attributes, except for those with special behaviors as described in the merge conflict heuristics. This creates a manifest merge error. You must apply other merge rule markers to resolve the conflict.

Marker Selector

If you want to apply the merge rule markers to only a specific imported library, add the tools:selector attribute with the library package name. For example, with the following manifest, the remove merge rule is applied only when the lower-priority manifest file is from the com.example.lib1 library. If the lower-priority manifest is from any other source, the remove merge rule is ignored. If it is used with one of the attribute markers, then it applies to all attributes specified in the marker.

Some Useful Tricks to Solve Merge Errors

  • Add the overrideLibrary attribute to the <uses-sdk> tag. This may be useful when we try to import a  library with a minSdkVersion value that is higher than the manifest file and an error occurs. The overrideLibrary tag lets the merger tool ignore this conflict. Thus, the library is imported and the app’s minSdkVersion value also stays lower.
  • The minSdkVersion of the application and all the used modules should be the same.
  • In addition to it, the build version of the app and modules should be exactly similar, i.e. the app’s build.gradle and the manifest.xml files should possess the same configurations.
  • Check for duplicity in the permissions and activity attributes in the manifest file.
  • Check for the versions of added dependencies. They should be of the same version.
  • Also, don’t forget to remove the reference of any deleted activity in the manifest file.
  • A few errors may occur due to label, icon, etc. tags in the manifest file. Try adding the following labels to resolve the issue:
    • Add the xmlns:tools line in the manifest tag.
    • Add tools:replace= or tools:ignore= in the application tag.

i am getting this error.

Error:Execution failed for task ‘:app:processDebugManifest’.

Manifest merger failed with multiple errors, see logs

can some help me out.? thanks in advanced.

here is my manifest file.

<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-feature
    android:name="android.hardware.location.gps"
    android:required="true" />
<uses-feature
    android:name="android.hardware.location.network"
    android:required="true" />

<application
    android:name="in.lszendriveapplication.com.LetsServiceApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:usesCleartextTraffic="true"
    android:networkSecurityConfig="@xml/network_security_config"
    android:targetSandboxVersion="1"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:appComponentFactory">

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyBCEk3vVJuNQ1FCanH95N0oryq-HNJFFsA" />

    <meta-data android:name="com.here.android.maps.appid" android:value="mHgbhAvbUSpLuIUdROCW"/>
    <meta-data android:name="com.here.android.maps.apptoken" android:value="2LPK6QnP5pg9M3MQwNPWgA"/>
    <meta-data
        android:name="com.here.android.maps.license.key"
        android:value="bsNRRcCfiIx8Hn2EJvklpu9N1c15bdQtqeUbM5H0n4GJQGGw8mBwqSdITi/z7R32vHnth0DqmQDdLJctDUK6n1tIBCO0S7FOVu+yF6gXDoBPhcsy2Q7orHiKWXIlQ0t5n0tj9OH5XCJVrpzF3EByLylpxst1roevyaSzvqLYZTtFyZXUIr8YbwnJYGp5Ggg24DwlNYIylNzMRVTiKkbRM02ekJYmQKyJwxV8aSqGDR8cOI70w5Cy8FK1J5J+psJPiszN54h6Wcer/vxGFQ384ABtgPI39Wish4giWWaZp9S1XA8b8Z2LtDFF2L+yOe2Epqi42O9cH0nApvQcxlQxXs7FVDADFsY1hmetK7uswGsAqW8mWp75c/upAXkPld4G6ZPV3ASMyik7cEpdbv0Qhdzdd47dpF0DatHB/wqr3DBPbOoPwsIoVS+rrVPNtnOkWObFOrbWQU/tvfxUcDdWc/JHS1rB+twW/BT0331rf4oy3XQeSR/uuL0fD/a9pviY1ylUE3yiREDUtPJheOHMuyG7aTSd92gOzOOq90aQMShyP3rCwRE8guxpiovhpu3c3AwY8xVe9bLHRQGdQ9pZv852gb9UkUdot2dKGgbMhCo73b1FlbCHpN9OV6+i3OlfEvK1YosTGI1X2djF6Msn4/IvWzLUPlieAwomsXMTKlA=" />

    <!--Developers should always provide custom values for each of {YOUR_LABEL_NAME} and {YOUR_INTENT_NAME}.
     Do not reuse HERE SDK defaults.-->
    <meta-data
        android:name="INTENT_NAME"
        android:value="Navigation" />

    <activity android:name="in.lszendriveapplication.com.zendrive.activities.SplashActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.NewStartRideActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.TripDetailsActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.MapActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.TripListActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="in.lszendriveapplication.com.place_search.LocationSearchActivity"
        android:screenOrientation="portrait" />

    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.SpeedMediatorActivity"
        android:screenOrientation="portrait" />

    <activity
        android:name="in.lszendriveapplication.com.zendrive.activities.ActivityIntroduction"
        android:screenOrientation="portrait" />

    <activity
        android:name="in.lszendriveapplication.com.user_authentication.LoginActivity"
        android:screenOrientation="portrait" />

    <activity android:name="in.lszendriveapplication.com.zendrive.activities.NewTripListActivity"
        android:screenOrientation="portrait" />

    <activity android:name=".place_search.PlacesSearchActivity"
        android:screenOrientation="portrait" />

    <receiver android:name="in.lszendriveapplication.com.zendrive.ZendriveSdkBroadcastReceiver" />
    <service android:name="in.lszendriveapplication.com.zendrive.SpeedMeter.GpsServices" />

    <uses-library
        android:name="com.google.android.maps"
        android:required="true" /> <!-- TODO: Add your maps api key here -->

    <receiver android:name="in.lszendriveapplication.com.zendrive.BootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <category android:name="android.intent.category.HOME" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
        </intent-filter>
    </receiver>

    <service
        android:name="com.here.android.mpa.service.MapService"
        android:label="Navigation"
        android:exported="false">
        <intent-filter>
            <action android:name="Navigation">
            </action>
        </intent-filter>
    </service>
    <!-- HERE Positioning Service definition. -->
    <service
        android:name="com.here.services.internal.LocationService"
        android:enabled="true"
        android:exported="false"
        android:process=":remote">
    </service>
</application>

Here is my gradle build.

apply plugin: ‘com.android.application’

apply plugin: ‘kotlin-android’

apply plugin: ‘kotlin-android-extensions’

android {
compileSdkVersion 28
buildToolsVersion ‘28.0.3’
defaultConfig {
applicationId «in.lszendriveapplication.com»
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName «1.0»
testInstrumentationRunner «android.support.test.runner.AndroidJUnitRunner»
vectorDrawables.useSupportLibrary = true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
}
dexOptions {
javaMaxHeapSize «4g» //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
lintOptions {
// This is needed to avoid spurious lint errors from libthrift on android.
disable ‘InvalidPackage’
abortOnError false
}
packagingOptions {
exclude ‘META-INF/LICENSE.txt’
exclude ‘META-INF/NOTICE.txt’
}
dataBinding {
enabled true
}
repositories {
flatDir {
dirs ‘libs’
}
mavenCentral()
google()
}
packagingOptions{
doNotStrip ‘/mips/.so’
doNotStrip ‘/mips64/.so’
}
}

dependencies {
implementation fileTree(dir: ‘libs’, include: [‘*.jar’])
implementation»org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version»
//noinspection GradleCompatible
implementation ‘com.android.support:appcompat-v7:28.0.0’
implementation ‘com.android.support.constraint:constraint-layout:1.1.3’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test🏃1.0.2’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’

implementation(name:'HERE-sdk', ext:'aar')
implementation 'org.locationtech.jts:jts-core:1.15.0'
implementation 'com.google.code.gson:gson:2.8.5'

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.ncorti:slidetoact:0.6.0'

implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

implementation 'com.android.support:multidex:1.0.3'
implementation 'com.zendrive.sdk.android:ZendriveSDK:5.6.3'

implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.github.blackfizz:eazegraph:1.2.5l@aar'
implementation('com.wdullaer:materialdatetimepicker:3.6.3') {
    exclude group: 'com.android.support', module: 'support'
    exclude group: 'com.android.support', module: 'design'
    exclude group: 'com.android.support', module: 'appcompat'
    exclude group: 'com.android.support', module: 'support-v13'
    exclude group: 'com.android.support', module: 'cardview'
}
implementation 'joda-time:joda-time:2.9.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'

implementation 'io.realm:realm-android:0.87.5'
annotationProcessor 'io.realm:realm-android:0.87.5'

}

Итак, я новичок в Android и Java. Я только начал учиться. В то время как я экспериментировал с Intent сегодня, я понес ошибку.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

Я нашел здесь несколько решений и попытался их реализовать, но это не сработало.

Это мой build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.0"

defaultConfig {
    applicationId "com.example.rohan.petadoptionthing"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}

Это мой AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
package="com.example.rohan.petadoptionthing" >

<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".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>

    <activity android:name=".Second"
        />

    <activity android:name=".third"/>
    <activity android:name=".MainActivity"/>


</application>

Это моя первая неделя с кодированием, мне жаль, если это действительно глупо. Я действительно новичок в этом и не нашел другого места, чтобы спросить. Извините, если я нарушил правила.

07 март 2016, в 13:11

Поделиться

Источник

26 ответов

Удалите <activity android:name=".MainActivity"/> из файла mainfest. Как вы уже определили его как:

 <activity
        android:name=".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>

Итак, файл манифеста показывает двусмысленность.

Android Geek
07 март 2016, в 13:06

Поделиться

Откройте манифест приложения (AndroidManifest.xml), нажмите » Merged Manifest Проверьте изображение

Изображение 111932

На изображении вы можете увидеть ошибку в правом столбце, попробуйте решить ее. Это может помочь кому-то с такой же проблемой. Подробнее здесь

CLIFFORD P Y
03 фев. 2017, в 12:37

Поделиться

Я также столкнулся с теми же проблемами, и после многих исследований нашел решение:

  1. Ваша версия min sdk должна быть такой же, как у модулей, которые вы используете, например: ваш модуль min sdk версии составляет 14, а ваша версия приложения min sdk — 9. Она должна быть такой же.
  2. Если версия сборки вашего приложения и модулей не одинакова. Опять же, это должно build.gradle ** Короче говоря, файл и манифест приложения build.gradle должны иметь одинаковые конфигурации **
  3. В файле манифеста нет дубликатов, подобных тем же разрешениям, что и дважды.
  4. Если вы удалили какую-либо деятельность из своего проекта, удалите ее и из файла манифеста.
  5. Иногда его из-за метки, значка etc тега файла манифеста:

a) Добавьте строку xmlns:tools в тег манифеста.

b) Добавить tools:replace= или tools:ignore= в теге приложения.

Пример:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.slinfy.ikharelimiteduk"
    xmlns:tools="http://schemas.android.com/tools"
    android:versionCode="1"
    android:versionName="1.0" >

  <application
      tools:replace="icon, label"
      android:label="myApp"
      android:name="com.example.MyApplication"
      android:allowBackup="true"
      android:hardwareAccelerated="false"
      android:icon="@drawable/ic_launcher"
      android:theme="@style/Theme.AppCompat" >
  </application>

</manifest>
  1. Если две зависимости не совпадают с примером версии: вы используете зависимость для appcompat v7: 26.0.0 и для facebook com.facebook.android:facebook-android-sdk:[4,5) facebook использует картографию версии com.android. поддержка: cardview-v7: 25.3.1 и appcompat v7: 26.0.0 использует картографию версии v7: 26.0.0, поэтому в двух библиотеках есть дисценария и, таким образом, дают ошибку

Ошибка: выполнение выполнено для задачи ‘: app: processDebugManifest’.

Не удалось слияние манифеста: атрибут meta-data#[email protected] value = (26.0.0-alpha1) из [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml: 27: 9 -38 также присутствует в [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml: 24: 9-31 value = (25.3.1). Предложение: add ‘tools: replace = «android: значение» «для элемента на AndroidManifest.xml: 25: 5-27: 41 для переопределения.

Таким образом, используя appomppat версии 25.3.1, мы можем избежать этой ошибки

Рассматривая вышеуказанные моменты, вы избавитесь от этой раздражающей проблемы. Вы также можете проверить мой блог https://wordpress.com/post/dhingrakimmi.wordpress.com/23

Kimmi Dhingra
15 сен. 2016, в 12:35

Поделиться

Для меня ЭТО работает —

Поиск слияния ошибок в AndroidManifest.xml

Изображение 111933

Нажмите «Объединенный манифест» в AndroidManifest.xml

Изображение 111934

Вы можете просмотреть ошибку слияния манифеста в правом столбце. Это может помочь решить эту проблему.

Anirban
13 авг. 2018, в 08:45

Поделиться

Я столкнулся с той же проблемой, и я добавил только одну строку в свой манифест. Xml, и это сработало для меня.

tools:replace="android:allowBackup,icon,theme,label,name"> 

добавьте эту строку под

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:theme="@style/AppThemecustom"
    tools:replace="android:allowBackup,icon,theme,label">

Надеюсь, это поможет.

Pre_hacker
01 апр. 2017, в 08:12

Поделиться

В дополнение к доступным решениям, пожалуйста, также проверьте это.
Если вы установили android:allowBackup="false" в свой AndroidManifest.xml, тогда может быть конфликт для android:allowBackup="true" в других зависимостях.

Решение
Как предложено @CLIFFORD P Y, переключитесь на Merged Manifest в AndroidManifest.xml. Android Studio предложит добавить tools:replace="android:allowBackup" в <application /> в ваш AndroidManifest.xml.

Chintan Shah
02 март 2017, в 06:39

Поделиться

В моем случае он показывал ошибку, потому что в элементе <uses-permission> была избыточность. Итак, проверьте файл AndroidManifest.xml.

Версия Android Studio 3.0.1

Операционная система — Windows 7

Вот скриншот для справки.

Изображение 111935

Parth Patel
30 апр. 2018, в 17:27

Поделиться

Обычно происходит, когда у вас есть ошибки в вашем манифесте. Откройте AndroidManifest.xml. Нажмите на объединенную вкладку манифеста. Здесь можно увидеть ошибки. Также есть предложения, упомянутые там. Когда у меня была аналогичная проблема при импорте com.google. android.gms.maps.model.LatLng, он предложил включить инструменты: overrideLibrary = «com.google.android.gms.maps» в тег приложения и сборка была успешной.

Archana Prabhu
28 июль 2017, в 12:56

Поделиться

В моем случае я исправил его

build.gradle (модуль: приложение)

defaultConfig {
----------
multiDexEnabled true
}
dependencies {
    ...........
    implementation 'com.google.android.gms:play-services-gcm:11.0.2'
    implementation 'com.onesignal:OneSignal:[email protected]'
    }

Этот ответ переименован в onSignal push notification

Md. Shofiulla
29 март 2018, в 15:43

Поделиться

В моем случае это произошло для того, чтобы оставить некоторый пустой фильтр намерений внутри тега Activity

    <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">

            <intent-filter>

            </intent-filter>

    </activity> 

Поэтому просто их устранение решило проблему.

    <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
    </activity> 

Dr TJ
14 нояб. 2018, в 05:29

Поделиться

Просто добавьте ниже код в свой тег приложения Manifest…

<application
        tools:node="replace">

sankalp
17 авг. 2018, в 15:21

Поделиться

Версия minium sdk должна быть такой же, как у модулей /lib, которые вы используете. Например: ваш модуль min sdk версии равен 26, а ваше приложение min sdk version равно 21. Оно должно быть таким же.

Ejaz Ahmad
13 авг. 2018, в 14:00

Поделиться

Откройте консоль градиента, затем вы увидите, что град предлагает добавить конкретную строку (например: tools: replace = «android: allowBackup» или инструменты: replace = «android: label» и т.д.). Добавьте эту строку в ваш файл манифеста под тегом и градиентом синхронизации, что и он.

Nazmus Saadat
25 фев. 2018, в 08:27

Поделиться

Если после добавления Библиотечного модуля Android и вы получите эту ошибку.
Вы можете исправить его простым удалением android:label="@string/app_name" из AndroidManifest.xml вашего модуля библиотеки Android

Phan Van Linh
07 июнь 2017, в 03:25

Поделиться

за последние несколько дней я тоже переживал ту же проблему. Но после, много исследований я наконец нашел решение для этого.

Чтобы решить эту проблему, вам нужно сделать следующее:
1. Убедитесь, что ваш проект build.gradle, а файл build.gradle содержит те же версии всех зависимостей.
2. Убедитесь, что ваш проект compileSdkVersion, buildToolsVersion, minSdkVersion и targetSdkVersion совпадает с вашим проектом в модулей или библиотек, которые вы добавили в проект.

compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "com.example.appname"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 22
    versionName "2.0.3"

}

Надеюсь, это поможет.

Rahul Deep Singh
08 апр. 2017, в 17:05

Поделиться

  • В AndroidManifest.xml:

    • В приложении добавьте tools:replace="android:icon, android:theme и
    • В корне манифеста добавьте xmlns:tools="http://schemas.android.com/tools
  • В build.gradle:

    • В корневой папке добавьте useOldManifestMerger true

ao wu
06 апр. 2017, в 09:24

Поделиться

Просто перейдите на Androidx, как показано выше, а затем установите минимальную версию SDK на 26… без сомнения, это работает отлично

sammy mutahi
29 апр. 2019, в 16:03

Поделиться

я решил эту проблему, удалив строку ниже из AndroidManifest.xml

android:allowBackup="true"

saigopi
31 янв. 2019, в 07:20

Поделиться

Моя проблема была связана с библиотекой поддержки, поэтому я сделал то, что @SHADOW NET сказал в моем модуле приложения build.gradle:

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '25.3.0'
        }
    }
}}

etini ukanide
22 нояб. 2018, в 21:49

Поделиться

Дополните ответ Phan Van Linh. Я удалил следующие строки:

  android:icon="@mipmap/ic_launcher"
  android:label="name"

Den
23 июнь 2018, в 18:56

Поделиться

Поместите это в конец вашего модуля приложения build.gradle:

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '25.3.0'
        }
    }
}}

из этого

SHADOW NET
02 июнь 2018, в 11:47

Поделиться

Я использовал FirebaseUI Library вместе с Facebook SDK Library, которая вызывала у меня проблему.

compile 'com.firebaseui:firebase-ui-database:0.4.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

И отсюда я избавился от этой проблемы.

С latest update библиотеки FirebaseUI также является частью предыдущей версии SDK для Facebook.

Если вы используете обе библиотеки, удалите библиотеку SDK для Facebook.

Mohammedsalim Shivani
13 янв. 2018, в 12:28

Поделиться

Это очень простая ошибка возникает только при определении любого вызова активности два раза в файле mainifest.xml Пример, например

<activity android:name="com.futuretech.mpboardexam.Game" ></activity>

//and launcher also------like that



//solution:use only one 

Lalit Baghel
08 авг. 2017, в 11:21

Поделиться

Случилось со мной дважды, когда я преломляю (переименовать с SHIFT + F6) имя поля в наших файлах, и он просит вас изменить его всюду, и мы, не обращая внимания, меняем имя везде.
Например, если у вас есть имя переменной «id» в вашем классе Java, и вы переименовываете его с помощью SHIFT + F6. Если вы не обратили внимание на следующее диалоговое окно, в котором вас спросят, где бы он ни изменил идентификатор, и отметьте отметку, все это изменит весь идентификатор в ваших файлах макета из нового значения.

Rakesh Yadav
09 июль 2017, в 06:17

Поделиться

Как новичок в Android Studio, в моем случае я переместил существующий проект из Eclipse в Android Studio и обнаружил, что было дублированное определение активности в моем манифесте .xml, который не был поднят Eclipse была показана как ошибка Gradle.

Я нашел это, перейдя в консоль Gradle (в нижней правой части экрана).

JanB
04 янв. 2017, в 12:05

Поделиться

Ещё вопросы

  • 0Извлечение контента из HTML с помощью PHP
  • 1Пигментное столкновение между прямоугольниками
  • 0функция ng-repeat вызывается несколько раз
  • 1Удалить верхнюю строку из кадра данных
  • 0получить выбранную строку pyqt5 qttablewidget
  • 1JS: ввести кнопку рядом с IP-адресом
  • 0Таймер высокого разрешения Linux в многопоточной среде?
  • 1Как я могу использовать файлы wdio.conf.js для указания папок с тестами, какие тесты e2e запускать?
  • 0MySQL Trigger для сравнения 2 значений из разных таблиц
  • 1JGit: состояние удаленного хранилища
  • 1Показать OutputStream (System.out) в текстовой области
  • 1Windowlicker не работает на OS X
  • 0Кендо У.И. Грид, Дюрандаль
  • 0получение выбранного значения для списка выбора в угловом виде из $ firebaseArray ()
  • 1Как подключить Python к Dialogflow Chatbot
  • 0Загрузите несколько изображений с помощью PHP и поместите их в базу данных MYSQL
  • 1Точность застряла на 50% керас
  • 1Android: фон с определенным размером?
  • 0Тестирование http-запроса, где в случае успеха вызовите другую функцию с помощью jasmine
  • 0Настройка основных параметров Netbeans
  • 02 вопроса на Backbone.js MVC
  • 1питон — дубликат лототона на экстракторе
  • 1Предварительно загрузить вид в Android?
  • 1Функция вызова ошибки в активной форме Yii2
  • 1Более эффективный способ извлечения данных из строки в JavaScript?
  • 0Ошибка: [ng: areq] Аргумент не является функцией, получил неопределенный
  • 1Как именно работает эта пользовательская директива Angular 2?
  • 1getElementByClassName не работает
  • 0dabeng Org Chart Php Mysql Ajax
  • 1Сделать поле доступным ТОЛЬКО для его соответствующего свойства?
  • 1Видео YouTube iFrame API периодически воспроизводится на мобильных устройствах
  • 1построение биржевых данных в plot.ly
  • 1Вызовите javascript из Iframe на страницу aspx [дублировать]
  • 0Откройте файл .doc, не указав путь к его приложению-обработчику C ++
  • 0Изменить цвет заливки импортированного файла SVG
  • 1массив размером 2 — если один из элементов пуст, установите его равным другому
  • 0ошибка c2953: шаблон класса уже определен
  • 0Как отформатировать это на стороне php
  • 1Класс C # Деинициализация динамической памяти
  • 1Настройки магазина приложений Android
  • 0Чтение данных из файла — сохранение в переменных или чтение снова и снова
  • 1Конвертировать строку в JavaScript, используя момент
  • 1Доступно ли гео-фехтование с полигонами и динамическими объектами на Android?
  • 0Nhibernate строительный запрос
  • 0невозможно получить данные, отправленные с запросом get на сервер узла
  • 0Как заполнить Div на основе JavaScript <script>?
  • 1Android, как показать другой вид поверх существующего ListView после того, как флажок установлен
  • 1Для альтернативы цикла для нескольких столбцов внутри функции (панды)
  • 1MultipartConfig аннотация / сервлет конфигурации
  • 1Ошибка панд. Почему мои объекты смешанного типа?

Сообщество Overcoder

Понравилась статья? Поделить с друзьями:
  • Error malformed statement
  • Error malformed list on input
  • Error malformed database schema
  • Error making static c
  • Error making sdcard fox directory required key not available