0

I am running into this issue almost everytime when I add a new module to my app but this time I am not able to resolve it at all. I am sick and tired of not friendly messages and tools of gradle. Someone please help: If you need dependencies output too let me know - it's big :(

Error: :app:transformClassesWithJarMergingForDebug FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/appengine/tools/appstats/Inter nalProtos$1.class

Here are 4 gradle files:

Top level gradle:

buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' classpath 'com.google.gms:google-services:1.5.0-beta2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() mavenCentral() } } 

App gradle:

apply plugin: 'com.android.application' apply plugin: 'hugo' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.app.myapp" minSdkVersion 15 targetSdkVersion 23 versionCode 1 multiDexEnabled true versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } apply plugin: 'com.google.gms.google-services' dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile files('libs/nineoldandroids-2.4.0.jar') compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.google.android.gms:play-services:8.3.0' compile 'com.android.support:cardview-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:gridlayout-v7:23.1.1' compile 'com.android.support:mediarouter-v7:23.1.1' compile 'com.android.support:palette-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.1.1' compile 'com.android.support:support-v13:23.1.1' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.mikhaellopez:circularimageview:2.1.1' compile 'com.cocosw:bottomsheet:0.+@aar' compile 'com.github.bumptech.glide:okhttp-integration:1.3.1' compile 'com.google.android.gms:play-services-auth:8.3.0' compile 'com.google.android.gms:play-services-gcm:8.3.0' compile project(path: ':backend', configuration: 'android-endpoints') compile project(path: ':commons') } 

Backend gradle:

buildscript { repositories { jcenter() } dependencies { classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18' } } repositories { jcenter(); } apply plugin: 'java' apply plugin: 'war' apply plugin: 'appengine' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 dependencies { appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18' compile 'com.google.appengine:appengine-endpoints:1.9.18' compile 'com.google.appengine:appengine-endpoints-deps:1.9.18' compile 'javax.servlet:servlet-api:2.5' compile 'com.ganyo:gcm-server:1.0.2' compile project(path: ':commons') } appengine { downloadSdk = true appcfg { oauth2 = true } endpoints { getClientLibsOnBuild = true getDiscoveryDocsOnBuild = true } } 

Commons gradle:

apply plugin: 'java' dependencies { compile 'com.googlecode.objectify:objectify:4.0b3' compile 'com.google.code.gson:gson:2.5' } 
1
  • change 'classpath 'com.google.gms:google-services:1.5.0-beta2' to 'classpath 'com.google.gms:google-services:1.5.0-beta3'. Hope it work Commented Jan 6, 2016 at 13:13

3 Answers 3

1

you can try like this

 compile 'com.android.support:multidex:1.0.1' 

It might help you.

Sign up to request clarification or add additional context in comments.

1 Comment

Did not helped. Got this error: :app:transformClassesWithJarMergingForDebug FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class
0

you can try this under

android {

packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } }

might help you

Comments

0

I removed compile project(path: ':commons') and it all worked. But I had to put same POJO in both app and backened. Putting them in common screwed up gradle. May be there is better way to share classes across app and backend.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.