How to solve A library uses the same package as this project? - java

How do I fix this?
Error:Execution failed for task ':androidmapsutils:processReleaseResources'.
> Error: A library uses the same package as this project: com.google.maps.android

If you use enforceUniquePackageName=false you'll eventually stumble upon this bug -
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: ... BuildConfig.class
and in order to fix that you'll have to check if some of your dependencies have multidex as a dependency in it and exclude it, for example the Facebook SDK -
compile('com.facebook.android:facebook-android-sdk:+') {
exclude group: 'com.android.support', module: 'multidex'
}
You can refer to this Stack Overflow and this Issue Tracker

compile project(path: ':backend', configuration: 'android-endpoints')
compile project(':library')
Check included package name
com.google.maps.android.

Related

snakeyaml-1.27-android.jar not found error while running tests

./gradlew test
Task :compileTestJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Could not find snakeyaml-1.27-android.jar (org.yaml:snakeyaml:1.27).
Searched in the following locations:
file:/Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar
I get the above error with the following definition in my build.gradle file, trying to exclude from javafaker doesn't help either. What should I do here?
// faker
testImplementation('com.github.javafaker:javafaker:1.0.2')
testImplementation group: 'org.yaml', name: 'snakeyaml', version: '1.27'
In my case, I just deleted snakeyaml dependencies directory manually (*/.m2/repository/org/yaml/snakeyaml), it works.
// https://mvnrepository.com/artifact/com.github.javafaker/javafaker
implementation 'com.github.javafaker:javafaker:1.0.2'
Result: Could not find snakeyaml-1.30-android.jar (org.yaml:snakeyaml:1.30).
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.30/snakeyaml-1.30-android.jar
Solution: Use dataFaker instead of javaFaker that will resolve all the issues, like so:
// https://mvnrepository.com/artifact/net.datafaker/datafaker
implementation 'net.datafaker:datafaker:1.5.0'
You need to exclude the org.yaml from the java faker dependency.
implementation ('com.github.javafaker:javafaker:1.0.2') { exclude module: 'org.yaml' }
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.26'
Workaround: Copy existing snakeyaml jar to the filename being searched
cp /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar /Users/user/.m2/repository/org/yaml/snakeyaml/1.27/snakeyaml-1.27-android.jar

Manifest Merger Error - Different versions of support library

I'm adding the stepper indicator library - https://github.com/badoualy/stepper-indicator - to my project. To do so, I added jitpack to my project gradle file and the stepper-indicator library to my app gradle file. However, I'm getting the following build error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:preference-v14:25.4.0] AndroidManifest.xml:25:13-35
is also present at [com.android.support:appcompat-v7:26.0.0-beta2] AndroidManifest.xml:28:13-41 value=(26.0.0-beta2).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
The other dependencies in my app include:
compile 'com.android.support:preference-v7:25.4.0'
compile 'com.android.support:preference-v14:25.4.0'
compile 'eu.davidea:flexible-adapter:5.0.0-rc2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
Without upgrading all of the android support libraries to an alpha version, is there a solution to this problem?
In build.gradle you can exclude conflicting dependencies. For example:
compile ('com.github.badoualy:stepper-indicator:1.0.7'){
exclude group: 'com.android.support', module: 'appcompat-v7'
}
To inspect dependencies, you can use Gradle toolbar in Android Studio -> application module -> tasks -> android -> androidDependencies
Update:

Gradle compile error with same module

i am trying to import 2 Libraries with Gradle.
When i am importing one of them its working but when i compile both i get the exception below.
I am working with Android Studio.
Getting the exception below:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/bouncycastle/crypto/CipherParameters.class
and my dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('org.bouncycastle:bcprov-jdk15on:1.50') {
exclude module: 'bcpkix-jdk15on' // Excluded to prevent cyclic dependencies
}
compile ('org.bouncycastle:bcpkix-jdk15on:1.50') {
exclude module: 'bcprov-jdk15on' // Excluded to prevent cyclic dependencies
}
}
Thanks
Marvin
Android is already using a cut down version of bouncy castle. It worked with com.madgag.spongycastle.

Cannot exclude module from Gradle

I'm trying to use Jersey on Android by adding
compile org.glassfish.jersey.core:jersey-client:2.16
to my build.gradle file. It gives me an unexpected top-level exception, so I added multiDexEnabled true to it as well.
Now I get:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/inject/Qualifier.class
I figured out that Jersey is trying to import both javax.inject:1 and javax.inject:2.4.0-b09. Okay no problem, we'll exclude the older one as recommended here. So I tried:
compile ('org.glassfish.jersey.core:jersey-client:2.16') {
exclude (module: 'javax.inject:1')
}
and
compile ('org.glassfish.jersey.core:jersey-client:2.16') {
exclude (group: 'javax.inject:javax.inject:1')
}
But the module won't go away no matter what. I'm at the end of my rope here and have no idea why this isn't working.
compile ('org.glassfish.jersey.core:jersey-client:2.16') {
exclude (group:'javax.inject', module:'javax.inject')
}
Worked. Thanks RaGe!

Execution failed for task ':app:dexDebug' Android Studio

The application was able to execute before updating my android studio,this is the error I am getting:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished
with non-zero exit value 1
If you have support-v4 and support-v7 (with different version) in build.gradle then add this line into your build.gradle at top.
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
Also read this
in my case, the
compile 'com.google.android.gms:play-services:+'
in my build.gradle exceeded the 65k method limit.
i changed it to
compile 'com.google.android.gms:play-services-maps:6.5.87'
to fix it (i only need maps in my application)
hope that helps
I got this error today out of nothing, after that i tried to update every single thing available, tried to change my gradle build as suggested here but none of it worked.
After hours of dispair and AS updates, a simple "clean project" and "rebuild project" worked for me.
Just rebuilding project fixes the issue (Build->Rebuild Project). You can also clean project
I fixed that adding:
compile ('com.facebook.android:facebook-android-sdk:3.22.0#aar'){
exclude module: 'support-v4'
}
Do this it really help me!
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
} write this inside gradle module. Hope it help!
Remove google analytics V2 helps for me
Try this :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}

Categories