Android google play services duplicate entry - android

I'm trying to use google services in my Android app, but I was getting the following error:
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_11\bin\java.exe'' finished with non-zero exit value 2
I was told to try adding multiDexEnabled = true and now the error has changed to this:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/GooglePlayServicesAvailabilityException.class
I looked through my libs but wasn't able to find any conflicts between them.
My jars:
gdata-client-1.0.jar
gdata-client-meta-1.0.jar
gdata-core-1.0.jar
gdata-spreadsheet-3.0.jar
gdata-spreadsheet-meta-3.0.jar
google-play-services.jar
My project gradle file has the following dependencies:
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'
My module gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.mydomain.myproject"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
}
Any help on fixing these errors would be appreciated.

I looked through my libs but wasn't able to find any conflicts between them
google-play-services.jar would appear to conflict with compile 'com.google.android.gms:play-services:7.5.0'. Remove that JAR and see if that helps.

Related

Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug'

My Android Studio is 2.3 Version. I am attempting to run the code but the app fails with the following errors, not sure what the problem is.
Here is the error:
Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug'
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --output C:\project\app\build\intermediates\reload-dex\debug C:\project\app\build\intermediates\reload-dex\debug\classes.jar}
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.ucmedia.project"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
apply plugin: 'com.android.application'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
jumboMode true
}}
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.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.2.0'
testCompile 'junit:junit:4.12'
}
I tried the following but the error still happens:
Clean and Rebuild the project
Re-imported the project as an external source into Android Studio.
Delete all jar and lib files from build directory.
Remove folder .gradle .idea folder.
Upgrading / Downgrade gradle / sdk.
Check for any duplicates of the support library in app.iml file.
Add multidex support.
Try to change
compile 'com.google.android.gms:play-services:8.1.0'
Adding the following code to 'build.gradle' app module solved my problem:
dependencies {
...
compile 'com.android.support:multidex:1.0.0'
...
}

Persistent error -Execution failed for task ':app:transformClassesWithJarMergingForDebug'

I am trying to add microsoft azure mobile services to my existing android app. After adding the .jar files in my folder. I am getting error:
Execution failed for task
':app:transformClassesWithJarMergingForDebug.
For various file like annotation.class, Gson$5.class and as you can see in the error file it shows ApiJsonOperationCallback.class.
I have tired a lot of things(such as ./gradlew clean and ./gradlew clean assemble) but have been running into deadends everywhere.
This is my gradle file
apply plugin: 'com.android.application'
android {compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jino.navigationplacepicker"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
defaultConfig {
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
}
And this is the error message
:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
:app:transformClassesWithJarMergingForDebug FAILED Error:Execution
failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/microsoft/windowsazure/mobileservices/ApiJsonOperationCallback.class
:app:compileDebugJavaWithJavac Note: Some input files use or override
a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Information:BUILD FAILED
Request you to please into this, and respond in layman terms as i am new to this.
The libraries are referenced twice in the gradle file causing them to conflict with each other.
The following lines are not needed.
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
The following line will download and reference the needed binaries for Azure Mobile Services.
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
Here is a copy of a gradle file for a working Android application.
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
}

Android : Error:Execution failed for task ':app:processDebugResources' exit with non-Zero Value 1

Am getting error when I rebuild the project. After I add the dependency for the google Map V2 this error occur.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Process 'command 'C:\Users\Binil\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
I tried to clean the project and rebuild the project but same issue occur again. Also I try sync the project but not solved
compile 'com.google.android.gms:play-services:8.4.0'
When I remove this dependency then app build successfully.
Gradle.build
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.android4dev.navigationview"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
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:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
}
Can any one please help me.
Add this with-in android tag to your module build.gradle:
dexOptions {
javaMaxHeapSize "4g"
}
Also, if you only want to use maps try to add this
compile 'com.google.android.gms:play-services-maps:8.4.0'
Instead of
compile 'com.google.android.gms:play-services:8.4.0'
Add apply plugin com.google.gms.google-services after dependencies
dependencies
{
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'

Gradle build failed with an Exception

I am quite new to the studio,
I am trying to Run my application
Error is encountered -
What went wrong:
Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
I tried with jdk 1.8 which gave the same error.
So found few answers which said to reduce jdk to 1.7
but the Error still persists
Please Suggest what to do
Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "innovapptive.com.mworkorder"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
}
This is what worked for me taken from this answer:
defaultConfig {
multiDexEnabled true
}
What worked for me was: Build-> Rebuild Project
I fllow the first answer and then another problem caused:
**Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/umeng/analytics/AnalyticsConfig.class**
Then it happened:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/umeng/analytics/AnalyticsConfig.class
So I tried to remove this:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':libraries:SlidingMenu')
compile files('libs/volley_src.jar')
compile files('libs/Volley_bin.jar')
// compile 'com.umeng.analytics:analytics:latest.integration'
// compile files('libs/umeng-analytics-v5.6.1.jar')
compile files('libs/xUtils-2.6.14.jar')
}
It works and I don't know why,I may try the latest Umeng SDK later.
It may work for you if you are using count and analysis SDK.

Google App Engine Gradle Dependency Conflict

I'm facing a problem with my dependencies in my app that will not let me add my endpoints-backend module as a dependency to my app module like so:
When I compile, it gives me this error:
Error:Execution failed for task ':app:preDexDebug'. >com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
When I remove the endpoints-backend dependency, the program runs, but I need it as a dependency so I can access the endpoints code inside my MainActivity.
Here's my Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.blume.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile project(path: ':cloud-backend', configuration: 'android-endpoints')
compile 'javax.persistence:persistence-api:1.0'
compile project(':endpoints-backend')
}
All Help is appreciated!
You should remove this line:
compile project(':endpoints-backend')
You have it included here:
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')

Categories

Resources