Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tools:replace specified at line:19 for attribute android:appComponentFactory, but no new value specified app main manifest

Tags:

I am trying to compile a 6 months old code, but I get this error:

tools:replace specified at line:19 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 18 Error: Validation failed, exiting app main manifest (this file)

To fix this issue, I added the following line in my AndroidManifest.xml

tools:replace="android:appComponentFactory"

But now I got this error:

Manifest merger failed with multiple errors, see logs

When I googles this error, it asks me to remove that line from AndroidManifest.xml that I added in first step. So, it's kind of a loop. How can I get rid of this.

My dependencies:

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/apache-mime4j-0.6 2.jar')
implementation files('libs/httpmime-4.0.1 .jar')
// this line must be included to integrate with Firebase
implementation 'com.hbb20:ccp:2.0.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.google.maps.android:android-maps-utils:0.4'
implementation 'com.google.android.gms:play-services-location:10.2.1'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.airbnb.android:airmapview:1.3.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.jd-alexander:library:1.1.0'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-maps:10.2.1'
implementation 'com.google.android.gms:play-services-wallet:10.2.1'
implementation 'com.stripe:stripe-android:4.1.5'
implementation 'com.stripe:stripe-java:1.47.0'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation 'com.google.firebase:firebase-database:10.2.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
testImplementation 'junit:junit:4.12'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:mediarouter-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

}

like image 288
Techleads MobileDevs Avatar asked Jan 16 '19 19:01

Techleads MobileDevs


1 Answers

Seems like you are having merger issues from another manifest file in your project. Many element names can appear several times in a manifest, such as multiple <uses-permission> elements. Many of those have an identifier, usually android:name, that distinguishes one from the next. In general, if two manifest sources both contribute the same element (i.e., same element name, same android:name value), those two elements are themselves merged, which means:

  • Any attributes that are in one, but not the other, are added to the combined element.
  • Any attributes that are in both, and are not identical in value, result in a merge conflict compile error, unless the resolution is specified via a marker
  • All child elements (e.g., inside of an ) are merged, applying the same rules.

Sometimes, the default merger rules will not work to your satisfaction. In particular, when there are conflicts, the build will fail, and probably that is not a desired outcome. To declare who wins in the case of conflicts, you can use tools:* attributes in the manifest elements. Specifically:

  • tools:node indicates how to resolve a conflicts between two editions of this particular XML element (e.g., an for the same android:name)
  • tools:replace indicates that certain attributes from a lower-priority edition of the manifest should be overwritten by their replacement values from a higher-priority edition of the manifest
  • tools:remove indicates that certain attributes from a lower-priority edition of the manifest should be removed entirely

Each of these, being in the tools namespace, will require you to have xmlns:tools="http://schemas.android.com/tools" on the root element, if it is not there already. These attributes only affect the build tools and have no runtime implications, other than in terms of how the build tools build your app based on the tools attributes.

like image 189
android_Muncher Avatar answered Dec 29 '22 01:12

android_Muncher