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"
}
Related
I am developing a React Native project and am using a third party library react-native-geolocation-service. Inside the build.gradle file of that library, the version of play-services-location is defined as so: (refer to this link for the entire build.gradle file)
dependencies {
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
implementation "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
}
Inside the build.gradle file of my project, I have the following:
buildscript {
ext {
...
googlePlayServicesVersion = "16.1.0"
}
}
Inside the app/build.gradle file of my project:
dependencies {
implementation(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
implementation ('com.google.android.gms:play-services-location:16.0.0') {
force = true
}
}
Even though I have specified in the gradle file to use version 16.0.0 for play-services-location, I still get the following error after I ran gradlew clean then gradlew build:
Execution failed for task ':react-native-geolocation-service:generateDebugRFile'.
Could not resolve all files for configuration ':react-native-geolocation-service:debugRuntimeClasspath'.
Could not find com.google.android.gms:play-services-location:16.1.0.
Why is gradle still looking for version 16.1.0 and not version 16.0.0?
If You are going to check the release notes from Here.
June 17, 2019
The release is
com.google.android.gms:play-services-location:17.0.0
October 2, 2018
The release was
com.google.android.gms:play-services-location:16.0.0
So there was no release Version 16.1.0 for location
The main androidSupportVersion that I want to use in my project is 27.1.1 but 'com.facebook.android:facebook-login:5.0.0' still fix dependency version to 27.0.2. That causes dependency collision in the project.
For now this piece of code comes with work-around solution by excluding one collided dependency called cardview-v7.
dependencies {
def androidSupportVersion = '27.1.1'
def withoutCardView = {
exclude group: 'com.android.support', module: 'cardview-v7'
}
implementation "com.android.support:appcompat-v7:$androidSupportVersion", withoutCardView
implementation 'com.facebook.android:facebook-login:5.0.0'
}
I got this error every time I try to run my android game:
Program type already present: android.support.v4.app.BackStackRecord$Op
Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[Unknown source file], tool name=Optional.of(D8)}
this is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.play.flyaway"
minSdkVersion 21
targetSdkVersion 27
ndk {
moduleName "player_shared"
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
buildTypes{}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
implementation files('libs/dagger-1.2.2.jar')
implementation files('libs/javax.inject-1.jar')
implementation files('libs/nineoldandroids-2.4.0.jar')
implementation files('libs/support-v4-19.0.1.jar')
}
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
Any solution to this problem? I already try everything I know of course, but I'm new on this, I really don't know what cause the error apart from what the console says
You need to remove the following dependency:
implementation files('libs/support-v4-19.0.1.jar')
and also remove the jar from libs directory. Then use the matching support library of your compileSdkVersion. So, change the above dependency with:
implementation 'com.android.support:support-v4:27.1.1'
This is related with Google play service dependency:
SDK Version Support in 11.2
When you upgrade your app’s Play services dependencies to 11.2.0 or
later, your app’s build.gradle must also be updated to specify a
compileSdkVersion of at least 26 (Android O). This does not change the
way your app runs. You will not be required to update
targetSdkVersion.
It's about duplicated support library used :
This dependency:
implementation files('libs/nineoldandroids-2.4.0.jar')
is using old version of support library. Try excluding the support library with:
implementation files('libs/nineoldandroids-2.4.0.jar'){
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
This Problem is caused due to the versions of the support file and plays service. Update the play service dependencies as per the recommendations(Latest) and sync the project.
compile 'com.google.android.gms:play-services:12.0.1'
I have used only support:AppCompat, so having this problem
Solved this using implementation 'com.android.support:design:____'
implementation 'com.android.support:support-v4:____' along with AppCompat
In my case the problem was I already had the jar present in lib/ folder. Deleting it resolved the problem.
So check if you have jar present in any folder:
find . -name *.jar
If present in lib folder try deleting it
I created a new project in Android Studio 2.2 Preview 1 with Android App and Backend module with Google Messaging. This is the app file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
But it's giving:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I am new to Android and not able to find what is this error. How do I fix it?
In your app's build.gradle add the following:
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
Enforces Gradle to only compile the version number you state for all dependencies, no matter which version number the dependencies have stated.
This is due to espresso. You can add the following to your apps build.grade to mitigate this.
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude group: 'com.google.code.findbugs'
}
METHOD 1:
I deleted the androidTestCompile on espresso-core line which was automatically included in a new project. Then my Android Studio compiles clean.
The androidTestCompile is in "build.gradle (Module:app)":
dependencies {
...
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
...
}
I don't know whether this deletion will have any problem down the road, but it surely works for my current project now.
METHOD 2: Adding an exclude on findbugs works too:
dependencies {
...
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs'
})
...
}
METHOD 3: Forcing compiling with a specific version:
(In the following I force it to compile with the higher version.)
dependencies {
...
androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0'
...
}
From Gradle Plugin User Guide:
When instrumentation tests are run, both the main APK and test APK share the same classpath. Gradle build will fail if the main APK and the test APK use the same library (e.g. Guava) but in different versions. If gradle didn't catch that, your app could behave differently during tests and during normal run (including crashing in one of the cases).
To make the build succeed, just make sure both APKs use the same version. If the error is about an indirect dependency (a library you didn't mention in your build.gradle), just add a dependency for the newer version to the configuration
Add this line to your build.gradle dependencies to use newer version for both APKs:
compile('com.google.code.findbugs:jsr305:2.0.1')
For future reference, you can check your Gradle Console and it will provide a helpful link next to the error to help with any gradle build errors.
The reason why this happen is that diff dependency use same lib of diff version.
So, there are 3 steps or (1 step) to solve this problem.
1st
Add
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
}
to your build.gradle file in android {...}
2nd
Open terminal in android studio
run ./gradlew -q app:dependencies command.
3rd
Click Clean Project from menu bar of android studio in Build list.
It will rebuild the project, and then
remove code in 1st step.
Maybe you need just exec 2nd step. I can't rollback when error occurs.
Have a try.
When I added module: 'jsr305' as an additional exclude statement, it all worked out fine for me.
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'jsr305'
})
The problem, as stated in your logs, is 2 dependencies trying to use different versions of 3rd dependency.
Add one of the following to the app-gradle file:
androidTestCompile 'com.google.code.findbugs:jsr305:2.0.1'
androidTestCompile 'com.google.code.findbugs:jsr305:1.3.9'
The accepted answer is one way of fixing the issue, because it will just apply some strategy for the problematic dependency (com.google.code.findbugs:jsr305) and it will resolve the problem around the project, using some version of this dependency. Basically it will align the versions of this library inside the whole project.
There is an answer from #Santhosh (and couple of other people) who suggests to exclude the same dependency for espresso, which should work by the same way, but if the project has some other dependencies who depend on the same library (com.google.code.findbugs:jsr305), again we will have the same issue. So in order to use this approach you will need to exclude the same group from all project dependencies, who depend on com.google.code.findbugs:jsr305. I personally found that Espresso Contrib and Espresso Intents also use com.google.code.findbugs:jsr305.
I hope this thoughts will help somebody to realise what exactly is happening here and how things work (not just copy paste some code) :).
Add this this to dependencies to force using latest version of findbugs library:
compile 'com.google.code.findbugs:jsr305:2.0.1'
delete espresso dependencies in gradle file works for me.
delete those lines in app gradle file:
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
i was trying to use airbnb deeplink dispatch and got this error. i had to also exlude the findbugs group from the annotationProcessor.
//airBnb
compile ('com.airbnb:deeplinkdispatch:3.1.1'){
exclude group:'com.google.code.findbugs'
}
annotationProcessor ('com.airbnb:deeplinkdispatch-processor:3.1.1'){
exclude group:'com.google.code.findbugs'
}
Those who are getting same error in Android 3.0.1,can resolve it by simply update the versions of compileSdkVersion and targetSdkVersion to 27 and also Implement com.android.support:appcompat-v7:27.1.1' in dependencies.
In project ':app' you can add the following to your app/build.gradle file :
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
For react-native-firebase, adding this to app/build.gradle dependencies section made it work for me:
implementation('com.squareup.okhttp3:okhttp:3.12.1') { force = true }
implementation('com.squareup.okio:okio:1.15.0') { force = true }
implementation('com.google.code.findbugs:jsr305:3.0.2') { force = true}
REACT NATIVE
If you looking for react native solution, then write this snippet in your affected node_modules gradle build file, e.g. firebase in my case.
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.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