This question already has answers here:
Manifest merger failed : Attribute application#appComponentFactory - Androidx
(14 answers)
Closed 7 months ago.
after I set my target and compile sdk versions to 28, I keep seeing this error:
Manifest merger failed : Attribute application#appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-41:19 to override.
Here is the app:gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.tawkon.data.lib.indooroutdoor"
minSdkVersion 14
targetSdkVersion 28
versionCode 3
versionName "1.6.4"
}
buildTypes {
release {
debuggable false
}
debug {
debuggable true
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'de.greenrobot:eventbus:2.4.1'
implementation 'com.splunk.mint:mint:4.2.1'
implementation 'joda-time:joda-time:2.3'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation project(':library')
}
I tried adding tools:replace="android:appComponentFactory" to application tag in the manifest, but it keep showing the error:
Manifest merger failed with multiple errors, see logs
What can be done to fix this?
Hi if you used androidx then please check your library project all dependency is androidx or not..
and change this dependency
implementation 'com.google.android.material:material:1.0.0'
Go to manifest file. And click on Merged Manifest. There you can find the suggestions just click on replace the error will be solved.
Please change this dependency implementation 'androidx.appcompat:appcompat:1.0.0' to implementation 'com.android.support:appcompat-v7:28.0.0' hopefully it will be of help to you.
follow these steps :-
add these two lines in grade.properties
android.useAndroidX=true
android.enableJetifier=true
Replace implementation 'com.android.support:appcompat-v7:28.0.0' with
implementation 'androidx.appcompat:appcompat:1.1.0'
sync your projects.
After sync project u need to change package name from import android.support.v7.app.AppCompatActivity to import androidx.appcompat.app.AppCompatActivity in Each activity
Related
I added MaterialAlertDialog to my project which was not using androidx. This caused errors during the next build. So i removed the 'implementation' statement from app level build gradle. But still i am having manifest merge error when i try to build my project.
This is the error i get during build time
Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:19:5-152:19 to override.
So far i have tried the following solutions,Close and reload my project. Do a clean and rebuild .delete the .gradle and .idea folders in my project and build it again
These are the dependencies in my project
dependencies
{
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:${android_support_version}"
implementation "com.android.support:design:${android_support_version}"
implementation 'com.github.lzyzsd:circleprogress:1.1.0#aar'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1#aar'
implementation 'commons-net:commons-net:3.3'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
implementation "de.hdodenhof:circleimageview:${circle_imageview}"
implementation "com.github.bumptech.glide:glide:${glide_version}"
implementation "com.android.support:recyclerview-v7:${android_support_version}"
implementation "com.android.support:cardview-v7:${android_support_version}"
implementation "com.squareup.retrofit2:retrofit:${retrofit_service_version}"
implementation "com.squareup.retrofit2:converter-gson:${retrofit_gson_convertor}"
implementation "com.clough.android.androiddbviewer:androiddbviewer:${dbviewer_version}"
implementation "com.android.support:multidex:${multidex_version}"
implementation "com.github.crosswall:Android-Coverflow:${viewPager_version}"
implementation "com.squareup.okhttp3:logging-interceptor:3.4.0"
implementation project(':sdkui')
implementation 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.4'
implementation 'com.google.android.gms:play-services-base:16.0.1'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
}
apply plugin: 'com.google.gms.google-services'
I am answering this just to specify the step it took to clear my issue.
I removed the gradle dependency for the MaterialDesign.
The cashe issue was solved by doing File-> Invalidate Cache & restart
Since Firebase was changed to ver 20 before restart the issue persisted.
Reduced Firebase version to 17.3.4 this fixed everything.
Add these lines in your Manifest file.
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
Manifest File
<application
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="#style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString">
Try this
With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
If you have any Maven dependencies that have not been migrated to the AndroidX namespace, the Android Studio build system also migrates those dependencies for you when you set the following two flags to true in your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
Add these lines in your Manifest file in Application TAG.
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
All of a sudden, with no changes to my dependencies, I am now getting the following error:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:18:2-31:16 to override.
I have tried applying the suggestion (along with the relevant namespace XML attribute), but unfortunately this yields a message along the lines of multiple errors, see logs, but I don't know where the logs are.
I've read and read into this, and I understand it's a problem with attempting to have AndroidX and the now deprecated support libraries at the same time. However, I have not changed any of my dependencies before this suddenly stopped building - only cleared my platforms to force a full rebuild.
I do not know which plugins are conflicting, and I also understand that Jetifier should remedy this, except NativeScript seems to not give me the ability to modify gradle.properties in any persistent way (that I am aware of), and currently the latest version of NativeScript (which is confusing because NativeScript is 5.4.1, TNS core modules is 5.4.2 and the platform added in my package.json seems to be 5.4.0) seems to not utilise Jetifier and the latest AndroidX build on NPM seems to be a bit out of date.
So, how can I get my app back up and running now? Help!
So I fixed this by moving my support dependencies into before-plugins.gradle, which now looks like this:
project.ext {
googlePlayServicesVersion = "15.0.0"
}
dependencies {
compile 'com.squareup.picasso:picasso:2.71828'
def googlePlayServicesVersion = project.googlePlayServicesVersion
compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
def supportVer = "28.0.0"
compile "com.android.support:support-v4:$supportVer"
compile "com.android.support:appcompat-v7:$supportVer"
compile "com.android.support:design:$supportVer"
}
And for good measure, here's my app.gradle:
android {
defaultConfig {
// Fix for: The number of method references in a .dex file cannot exceed 64K.
// (see: https://developer.android.com/tools/building/multidex.html)
multiDexEnabled true
minSdkVersion 17
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
def settingsGradlePath
if(project.hasProperty("appResourcesPath")){
settingsGradlePath = "$project.appResourcesPath/Android/settings.gradle";
} else {
settingsGradlePath = "$rootDir/../../app/App_Resources/Android/settings.gradle";
}
def settingsGradleFile = new File(settingsGradlePath);
if(settingsGradleFile.exists())
{
apply from: settingsGradleFile;
}
Forcing the following dependencies did it for me.
dependencies {
compile 'com.google.android.gms:play-services-analytics:16.0.4'
implementation('com.google.android.gms:play-services-analytics:16.0.6'){
force = true
}
implementation('com.google.android.gms:play-services-base:16.1.0'){
force = true
}
}
I fixed this by taking a look to ./gradlew app:dependencies and i fixed any package that appeared to be using an updated dependency that uses androidx to a previous version.
So you can see here that tagmanager was resolving as 17 because the dependency uses '+', so instead i fixed this one to 16.0.8
implementation (project(':react-native-device-info')) {
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}
implementation (project(':react-native-google-analytics-bridge')){
exclude group: 'com.google.android.gms', module: 'play-services-analytics'
exclude group: 'com.google.android.gms', module: 'play-services-tagmanager-v4-impl'
}
implementation (project(':react-native-admob')) {
exclude group: 'com.google.android.gms', module: 'play-services-ads'
}
implementation ('com.google.android.gms:play-services-gcm:16.1.0') {
force = true
}
implementation ('com.google.android.gms:play-services-ads:17.2.0') {
force = true
}
implementation ('com.google.android.gms:play-services-analytics:16.0.8') {
force = true
}
implementation ('com.google.android.gms:play-services-tagmanager-v4-impl:16.0.8') {
force = true
}
I only updated GooglePlayservices to 15.0.0 and added this to the AndroidManifest inside <application>.
<application>
...
<uses-library android:name="org.apache.http.legacy"
android:required="false"/>
...
<application/>
Got same error, check libraries version, for me, Firebase was the problem.
before-plugins.gradle
project.ext {
googlePlayServicesVersion = "15.0.1"
googleFirebaseServicesVersion = "18.0.0"
}
dependencies {
def googlePlayServicesVersion = project.googlePlayServicesVersion
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
compile "com.google.firebase:firebase-messaging:$googleFirebaseServicesVersion"
}
When I'm building Gradle with androidx I get the following error. Please help me to solve this issue.
Error Message: Manifest merger failed : Attribute
application#appComponentFactory
value=(android.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
value=(androidx.core.app.CoreComponentFactory).
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kanwarpreet.dealmybook">
<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=".activities.SplashActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.LoginActivity" />
<activity android:name=".activities.RegisterActivity" />
<activity
android:name=".activities.HomeActivity"
android:label="#string/title_activity_home"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".activities.BookDetailsActivity"
android:label="#string/title_activity_book_details"
android:theme="#style/AppTheme.NoActionBar"/>
<activity android:name=".activities.AddBookActivity" />
</application>
</manifest>
Build.Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.kanwarpreet.dealmybook"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Put these flags in your gradle.properties
android.enableJetifier=true
android.useAndroidX=true
After hours of struggling, I solved it by including the following within app/build.gradle:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Put these flags in your gradle.properties
android.enableJetifier=true
android.useAndroidX=true
Changes in build.gradle:
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
Refer to: https://developer.android.com/jetpack/androidx/migrate
Reason of this error-
Because after upgrade, androidx.core:core is accessed somewhere, when your project is still not using androidx. So classes like CoreComponentFactory and many others are now found at two places - androidx.core:core and com.android.support:support-compat. That's why this error occured.
What is solution?
You should migrate to AndroidX. If you don't know about AndroidX. Please read What is AndroidX?
How to migrate your project
After Android Studio 3.2 (September 2018), there is direct option to migrate existing project to AndroidX. This refract all packages automatically.
Before you migrate, it is strongly recommended to backup your project.
Existing project
Android Studio > Refactor Menu > Migrate to AndroidX...
It will analysis and will open Refractor window in bottom. Accept changes to be done.
New project
Put these flags in your gradle.properties
android.enableJetifier=true
android.useAndroidX=true
Check #Library mappings for equal AndroidX package.
Check #Official page of Migrate to AndroidX
Error explicitly says-
[com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.0.0]
AndroidX is the latest support library from Google. It contains all previous components from all older appcompat versions. Do NOT use appcompat-v-any number. Instead, use a similar component from AndroidX libraries. Remove the numbered support libraries from your Gradle and your code wherever it is imported. Then sync your gradle.
Component similarity table can be found here. Also, follow the steps mentioned in Migrating to AndroidX.
Again, stop using any previous appcompat numbered versions. There's only AndroidX now.
Hope this helps.
you have to move on the Androidx because your project is using some feature
from there.so you need to migrate to AndroidX
follow these snippets
look at this second snippet
One suggestion to find out the exact reason is to open the manifest file and in bottom you will see a Merge Manifest option where you will see exact reason for failure.
See below image
Just add a line into gradle.properties
android.enableJetifier=true
android.useAndroidX=true
Project-wide Gradle settings.
IDE (e.g. Android Studio) users:
Gradle settings configured through the IDE will override any settings specified in this file. For more details on how to configure your build environment visit http://www.gradle.org/docs/current/userguide/build_environment.html
Specifies the JVM arguments used for the daemon process. The setting is particularly useful for tweaking memory settings
org.gradle.jvmargs=-Xmx1536m
android.enableJetifier=true
android.useAndroidX=true
When configured, Gradle will run in incubating parallel mode. This option should only be used with decoupled projects. More details, visit http://www.gradle.org/docs/current/userguide/multi_project_builds.html
sec:decoupled_projectsvorg.gradle.parallel=true
I also faced this problem because I was using some external library in my project and one of them was not converted into AndroidX.
add below code to android/build.gradle under buildscript ext
googlePlayServicesVersion = "16.0.0"
googlePlayServicesVisionVersion = "17.0.2"
and below code to gradle.properties
android.enableJetifier=true
android.useAndroidX=true
I let Android Studio convert my Relative layout views to Constraint layout. So Android Studio added one of the com.andriod.support... while I added the androidx... dependency when I removed the second one the error was gone.
dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
}
This was my error:
Manifest merger failed : Attribute application#appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.3.2] AndroidManifest.xml:24:18-86
is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:3-26:17 to override.
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:one.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
In manifest add tools:replace="android:theme" to your application
I have resolve problem by removing
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
from app build.gradle and using
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
instead of it.
I am trying to add firebase to my app using the firebaseUI. As the documentations says, I have used the corresponding gms:play-services (11.0.4) with the firebaseUI version (2.2.0)
When I sync the gradle files, I receive following error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.0) from [com.android.support:support-v13:26.0.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:customtabs:25.4.0] AndroidManifest.xml:25:13-35 value=(25.4.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
This is my gradle file:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.test.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:support-v13:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:recyclerview-v7:26.0.0'
//firebase
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'
testCompile 'junit:junit:4.12'
}
//firebase
apply plugin: 'com.google.gms.google-services'
I've made sure that all the versions are up to date and that they are all the same. Can't figure out what the problem is?
I solved the problem by adding:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.0'
}
}
}
}
from here.
The tooltip recommended adding tools:replace="android:value"' to meta-data but this throws another error, so im going with the solution above
I solved it by adding this in AndroidManifest.xml within the <application> tag at the very bottom:
<meta-data
tools:node="replace"
android:name="android.support.VERSION"
android:value="26.1.0" // <- The max version you see in the error message. For me it was 26.1.0
/>
Then add these two attributes to the <manifest ... > tag:
xmlns:tools="http://schemas.android.com/tools"
tools:node="replace"
It's happening because two versions of support libraries are clashing. On top, you have declared
buildToolsVersion "26.0.1"
and in dependencies, the version is 26.0.0
compile 'com.android.support:design:26.0.0'
Just change the support library version to 26.0.1 and it will work fine. I did the same, worked flawlessly in my case.
add this line at the end of app level gradle file
apply plugin: 'com.google.gms.google-services'
I was able to solve by hoovering over
compile 'com.android.support:appcompat-v7:26.0.0' and adding the libraries manually that it said was wrong such as
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:animated-vector-drawable:26.0.0'
compile 'com.android.support:customtabs:26.0.0'
add this line to your manifest
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"
tools:replace="android:value" />
exactly as shown inside the "application" tag.
This type of error has come up because of different libraries added by you.
While adding libraries make sure that all of them are of the same version and work flawlessly with one another.
It occurs when you use different versions of the same library for implementation in the build.gradle of app module. You can solve this by implementing same versions of a library.
If the problem still persists then add the following code at the end of build.gradle(app module)
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'
}
}
}
}
After accepting to update the project to new version of gradle I get this error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.0-alpha1) from [com.android.support:cardview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38
is also present at [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:41 to override.
How can I solve this problem?
This is my app's build.gradle file:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.sample.bookReader"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
...
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:+'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:25+'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
...
}
And this is the project's build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://www.jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
How do I fix this error while maintaining the changes made by updating the gradle version?
Put this at the end of your app module 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'
}
}
}
}
Credit to Eugen Pechanec
You are using multiple versions of the Android Support Libraries:
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:25+'
Two are 26.0.0-alpha1, and one is using 25+.
Pick one concrete version and use it for all three of these. Since your compileSdkVersion is not O, use 25.3.1 for all three of these libraries, resulting in:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
I changed all support library versions to 25.3.1 and worked like a charm:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
You also need to change compileSdkVersion and targetSdkVersion to 25:
compileSdkVersion 25
targetSdkVersion 25
You can find out what library depends on a wrong version of the support library and exclude it like this:
compile ('com.stripe:stripe-android:5.1.1') {
exclude group: 'com.android.support'
}
stripe-android in my case.
I'm not using different versions of libraries and got the same error, it's happened after remove buildToolsVersion in AS RC 1, but adding tools:node="replace" did the trick, just add this into your manifest.xml inside <application ..../> block:
<meta-data
tools:node="replace"
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
It happen the same thing to me. See on Gradle -> Build Gradle -> and make sure that the compatibility matches in both compile "app compat" and "support design" lines, they should have the same version.
Then to be super sure, that it will launch with no problem, go to File -> Project Structure ->app and check on tab propertie the build Tools version, it should be the same as your support compile line, just in case i put the target SDK version as 25 as well on the tab Flavors.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
*compile 'com.android.support:appcompat-v7:25.3.1'*
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
*compile 'com.android.support:design:25.3.1'*
}
Thats what I did and worked. Good luck!
Update your support library to last version
Open Manifest File , and add it into Manifest File
<uses-sdk tools:overrideLibrary="android.support.v17.leanback"/>
And add for recyclerview in >> build.gradle Module app :
compile 'com.android.support:recyclerview-v7:25.3.1'
And click : Sync Now
I solve that with putting this at the end of my app module 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 '26.0.0'
}
}
}
}
The answer are accepted but one thing you could also do is to define the libraries from your project structure. What you can do is :
Comment all the libraries in which problem is coming
Goto your project structure
Add libraries from there and it'll sync automatically and the problem goes off.
If problem persists try looking from the error log that what library is it demanding after following all the above 3 steps.
What happens is the predefined libraries as off now now I'm taking the appcompat:26.0.0-alpha1 it uses the older version of the things when you add something new and tries to resolve it with the old stuffs. When you add it from your project structure, it'll add the same thing but with the new stuffs to resolve it. Your problem would be resolved.
The error for me was:
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
The solution for me was in my project Gradle file I needed to bump my com.google.gms:google-services version.
I was using version 3.1.1:
classpath 'com.google.gms:google-services:3.1.1
And the error resolved after I bumped it to version 3.2.1:
classpath 'com.google.gms:google-services:3.2.1
I had just upgraded all my libraries to the latest including v27.1.1 of all the support libraries and v15.0.0 of all the Firebase libraries when I saw the error.
I have updated old android project for the Wear OS. I have got this error message while build the project:
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.2) from [com.android.support:percent:26.0.2] AndroidManifest.xml:25:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
My build.gradle for Wear app contains these dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.support:wearable:2.4.0'
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
compileOnly 'com.google.android.wearable:wearable:2.4.0'}
SOLUTION:
Adding implementation 'com.android.support:support-v4:28.0.0' into the dependencies solved my problem.
Try deleting the meta data and rebuild project.
you try read link this
Error:Execution failed for task ‘:app:processDevDebugManifest’. Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.3.0) then usd VERSION 26.0.0
: https://medium.com/#PongPloyAppDev/error-execution-failed-for-task-app-processdevdebugmanifest-48576be751