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?
The initial process would be to open the manifest application known as the AndroidManifest. xml and then click on the Merged Manifest tab below your edit pane. Following which, Click on the merged manifest option. An Error would be visible at the right column and then one must try to solve the error.
The following hack works: Add the xmlns:tools="http://schemas.android.com/tools" line in the manifest tag. Add tools:replace="android:icon,android:theme,android:allowBackup,label,name" in the application tag.
Inspect the merged manifest and find conflicts Even before you build your app, you can see a preview of what your merged manifest looks by opening your AndroidManifest. xml file in Android Studio, and then clicking the Merged Manifest tab at the bottom of the editor.
The file is located at WorkspaceName>/temp/<AppName>/build/luaandroid/dist. The manifest file provides essential information about your app to the Android operating system, and Google Play store. The Android manifest file helps to declare the permissions that an app must have to access data from other apps.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With