I am attempting to integrate Pushy (https://pushy.me/) into my app to allow for more reliable real-time notifications, in place of GCM.
However, upon attempting to run the app, the error below appears:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/core/base/GeneratorBase$1.class
Below is my build.gradle class:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1" // 22.0.1
defaultConfig {
applicationId "com.example.android.myapp2"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dataBinding {
enabled = true
}
}
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I have attempted to clean, rebuild, but nothing helps.
How can I alleviate this issue?
After contacting the support line, I simply needed to prevent duplicate references of the jackson library:
configurations {
all*.exclude group: 'com.fasterxml.jackson.core'
}
and changed the dependencies to:
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile files('libs/pushy-1.0.7.jar') //** Specified **
}
Related
I am Importing my project from Eclipse , while building an APK i found following Error.
Error:Execution failed for task
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/plus/PlusOneButton$OnPlusOneClickListener.class
Error:Execution failed for task ':gruhini:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/games/Game.class
Error:Execution failed for task ':gruhini:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/GoogleAuthException.class
Error:Execution failed for task ':gruhini:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/**'
}
defaultConfig {
applicationId "com.gruhini"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
preDexLibraries false
//javaMaxHeapSize "1G" // 2g should be also OK
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':eclipseProject')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/google-play-services.jar')
compile files('libs/httpclient-4.1.jar')
compile files('libs/httpcore-4.1.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/itextpdf-5.2.1.jar')
compile files('libs/mail.jar')
compile files('libs/mpandroidchartlibrary-1-7-4.jar')
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
}
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/plus/
Problem
compile files('libs/google-play-services.jar') // Remove this line
compile 'com.google.android.gms:play-services:10.2.0' //10.0.1 or 9.6.0
Both are same .Call one of them .
Then Clean-Rebuild and Run .
Try with this App Level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.gruhini"
minSdkVersion 15
targetSdkVersion 25
versionCode 12
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile project(':eclipseProject')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/httpclient-4.1.jar')
compile files('libs/httpcore-4.1.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/itextpdf-5.2.1.jar')
compile files('libs/mail.jar')
compile files('libs/mpandroidchartlibrary-1-7-4.jar')
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
}
Project Level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2' //2.2.3
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Do inside Android in your gradle file like this.
android{
configurations {
all*.exclude group: 'com.android.support', module:'support-annotations'
}
}
instead of you write inside dex option.
your gradle file will looks like..
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
useLibrary 'org.apache.http.legacy'
configurations {
all*.exclude group: 'com.android.support', module:'support-annotations'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/**'
}
defaultConfig {
applicationId "com.gruhini"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
preDexLibraries false
//javaMaxHeapSize "1G" // 2g should be also OK
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
})
compile project(':eclipseProject')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/google-play-services.jar')
compile files('libs/httpclient-4.1.jar')
compile files('libs/httpcore-4.1.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/itextpdf-5.2.1.jar')
compile files('libs/mail.jar')
compile files('libs/mpandroidchartlibrary-1-7-4.jar')
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
}
It works Properly by Removing Following Lines from Gradle . compile fileTree(dir: 'libs', include: '*.jar')
There is a mismatch between the play-services versions being used in your packages (i.e. a package using version x, another package using version y).
None of the other answers explain why you should use play-services version x.y.z or how to check which one is applicable. You can check that with ./gradlew :app:dependencies
You will get an output similar to
| \--- com.google.android.gms:play-services-tasks:10.2.6 --> (11.0.1)(*)
+--- com.google.android.gms:play-services-basement:11.0.1 (*)
```
From this output you can see the latest version of play-services being used in your project (in the above example it's 11.0.1).
In your build.gradle file, you should specify this version for all play-services (they all must be the same version).
I have worked in android project in android studio, When i start run gradle build and the following errors shown. Anyone help me what is the problem
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.stage.lookara"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/twitter4j-core-4.0.4.jar')
compile files('libs/slider.jar')
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.github.darsh2:MultipleImageSelect:v0.0.3'
compile files('libs/pherialize-1.2.1.jar')
compile 'com.wang.avi:library:2.1.3'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile
'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.felipecsl:gifimageview:2.1.0'
}
repositories {
jcenter()
}
dependencies {
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'org.jsoup:jsoup:1.7.3'
}
You are compiling the whole Google play services library:
compile 'com.google.android.gms:play-services:8.3.0'
which can cross the 64K reference limit' during compiling..
See this
if u just use some services from the library you can Selectively compiling APIs into your executable
Like:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
I would also suggest to use latest version of play services compile 'com.google.android.gms:play-services:10.2.1'
2nd Way
If you really want to use the whole library : Enable Multidex in your application.
in your Gradle:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
in Application class:
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Define the application class in manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
Try clean first.
If it does not works, add multiDexEnabled to your build.gradle file.
defaultConfig {
multiDexEnabled true
}
See this: com.android.build.transform.api.TransformException
I'm using Firebase UI in my app but having difficulty building the app after adding the Firebase UI dependency. It complains about
'com/google/android/gms/auth/api/signin/internal/zzf.class' being duplicated, so I added an exclude statement for it but without success. Here is how my build.gradle look like:
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "appfactory.app.chatapp"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'com/google/android/gms/auth/api/signin/internal/zzf.class'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:0.6.2'
}
apply plugin: 'com.google.gms.google-services'
And here is the error I get
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
From the readme file of FirebaseUI for Android — UI Bindings for Firebase
Each version of FirebaseUI has dependency on a fixed version of these
libraries, defined as the variable firebase_version in
common/constants.gradle
In your case you are using 0.6.2 and the corresponding com.google.firebase:firebase version is 9.8.0
So changing
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
to
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
Should fix the problem.
I get and error when I try to Sync project with Gradles files
Here is the error
Error:Execution failed for task ':app:processDebugGoogleServices'.
No matching client found for package name 'ua.com.qascript.android'
And here is the Gradle file content:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
packagingOptions {
exclude('META-INF/NOTICE')
}
packagingOptions {
exclude('META-INF/LICENSE')
}
defaultConfig {
applicationId "ua.com.qascript.android"
minSdkVersion 14
targetSdkVersion 22
versionName '1.7'
versionCode 11
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley.jar')
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.android.support:design:24.2.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
Well, this error appear after I update the Google Play Services to can add Firebase Cloud Messages, it request minimum vers 9.0.
Please help me to fix it. Thanks.
My project is a Chat app that uses Parse. After added other dependencies, this problem started appearing:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 2
Searching here in StackOverflow, some folks told me that it could be the 65K limit from Android.
So, to solve I followed the steps below:
1 - Add Multidex
DefaultConfig {
multiDexEnabled true
}
and
compile 'com.android.support:multidex:1.0.0'
https://developer.android.com/tools/building/multidex.html
2 - Enable Jumbo Mode in Android Gradle Settings
dexOptions {
jumboMode = true
}
I cleaned the project and ran the gradle build. It did not generate any errors. Great! But when I click "Run app" it generates this error below.
Error: Execution failed for task ': app:
packageAllDebugClassesForMultiDex'. > Java.util.zip.ZipException:
duplicate entry: bolts / AggregateException.class
If I remove the dependency 'com.parse.bolts: bolts-android: 1. +' the "Run app" works, but I can not do without the dependency of Parse.
This is my Gradle build script:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "br.com.triangulum.mink"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode = true
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile('com.android.support:multidex:1.0.0') {
exclude group: 'com.parse.bolts',
module: 'bolts-android'
}
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'Parse*.jar')
compile project('libraries:httprequest')
compile project('libraries:cameralibrary')
compile project('libraries:bgarefreshlayout')
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:design:+'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.afollestad:material-dialogs:0.7.4.0'
compile 'com.getbase:floatingactionbutton:1.10.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'de.greenrobot:eventbus:2.4.+'
compile'com.edmodo:cropper:1.0.+'
compile 'com.github.ksoichiro:android-observablescrollview:+'
compile 'com.etsy.android.grid:library:1.0.5'
compile('com.mikepenz:actionitembadge:3.0.2#aar') {
transitive = true
}
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.android.support:multidex:1.0.+'
}
try to change this:
compile('com.android.support:multidex:1.0.0') {
exclude group: 'com.parse.bolts',
module: 'bolts-android'
}
To this:
compile('com.android.support:multidex:1.0.0');
the bolds module is used sometimes to fix Duplicated dexLibs
Regards
Your com.facebook.android:facebook-android-sdk:4.1.0 library is messing with parse as both use same bolts-android module internally and having a different version of this module. Try to exclude this module from any of parse or facebook gradle dependency.
compile('com.facebook.android:facebook-android-sdk:4.1.0') {
exclude group: 'com.parse.bolts',
module: 'bolts-android'
}
I was having the same problem and When I run ./gradlew yourModuleName:dependencies by the terminal, I found exactly which two libraries are messing with each other having a different version of the same module internally.