ExecException when adding the new support design library - android

I'm trying to add the new Support Design library to my project:
compile 'com.android.support:design:22.2.0'
But as soon as I try to compile, I get the following error:
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_40\bin\java.exe'' finished with non-zero exit value 3
I've already reached the 65k method limit a few libraries back, so I already added MultiDex support and solver that problem a while ago.
Here are all my dependencies, if it helps:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.9'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2#aar') {
transitive = true;
}
compile 'com.helpshift:android-aar:3.8.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.kierans:ViewPagerIndicator:138e5f5bd9'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'pl.charmas.android:android-reactive-location:0.6#aar'
compile 'io.reactivex:rxjava:1.0.10'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
I know there are a lot of them, but I need them all.

You should consider changing your compile 'com.google.android.gms:play-services:7.5.0' dependency, and grab only a portion of the Play Services.
You can see the guide for it at https://developers.google.com/android/guides/setup#split , that will most likely solve your 65k issue as well.

Related

Paytab Payment gateway not working

I have to integrate paytabs payment gateway. After integrating their sdk module, the application not builds & app gets an error. My app gradle has below dependency.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.afollestad.material-dialogs:core:0.9.1.0'
compile 'com.kyleduo.switchbutton:library:1.4.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile project(':PayTabs_SDK_SRC')
}
The Error looks like:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/Address.class
Update:
If i remove below two dependency i don't get any error. But must have to use this
retrofit dependence. Any Idea?
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
Look, PayTabs SDK includes
com.squareup.okhttp3(version 3.5.0) and com.squareup.retrofit2:retrofit:2.2.0 uses okhttp3(version 3.6.0) which confused Gradle and generates a dexException(duplicate files exception).
To solve this problem you need to exclude one of okhttp3 version. Replace these below lines in build.gradle file.
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
With these lines of code:
compile ('com.squareup.retrofit2:retrofit:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
compile ('com.squareup.retrofit2:converter-gson:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
Hope it will work.

Facebook SDK causing 'appDebug' error android studio

I am trying to incorporate Facebook SDK , but Android Studio is giving me errors at compile time.
Here is my error:
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_51\bin\java.exe'' finished with non-zero exit value 2
Gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/junit-4.10.jar')
compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/signpost-jetty6-1.2.1.1.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile project(':stripe')
compile project(':FacebookSDK')
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.specyci:residemenu:1.6+'
compile 'com.android.support:multidex:1.0.0'
}
But this doesn't work, and honestly isn't a good solution. When I remove facebook sdk, my app compiles no problem, but with it nothing works. What am I missing here?
You are over 64K methods in your build because of using so many libraries, enable multiDex, clear unused libraries, remove unused methods with ProGuard or whatever you want, but you have reached the method count limit for a single APK.

Duplicate files copied android studio

I have been trying to integrate admob into my project when suddenly this error appears
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml
File1: C:\Users\SkyPunch\AndroidStudioProjects\GyanBox\app\build\intermediates\exploded-aar\com.longtailvideo.jwplayer\jwplayer-android-sdk\2.4.1+158\jars\classes.jar
File2: C:\Users\SkyPunch\AndroidStudioProjects\GyanBox\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\9.4.0\jars\classes.jar
I think its an issue with same classes in two liberaries
I have used these
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.github.amlcurran.showcaseview:library:5.4.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'com.nononsenseapps:filepicker:2.4.2'
compile 'com.rockerhieu.emojicon:library:1.3.3'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.neovisionaries:nv-websocket-client:1.23'
compile 'com.theartofdev.edmodo:android-image-cropper:1.2.6'
compile 'com.longtailvideo.jwplayer:jwplayer-android-sdk:+'
compile 'com.android.support:percent:23.3.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
How can i resolve this without removing any of the libraries
Edit: i found that by following it can be resolved
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
Will this have any impact on app. Am i excluding an important file?

This: finished with non-zero exit value 2

Error:Execution failed for task ':app:dexMt_360Debug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
build.gradle in my project:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile project(':J2WBase')
compile 'com.facebook.react:react-native:0.17.1'
}
build.gradle in the third party framework:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.jakewharton:butterknife:6.1.0'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'commons-lang:commons-lang:2.6'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'de.greenrobot:eventbus:2.4.0'
}
I have tried to delete the build folder, re build project
Upgrade buildtools to the latest version
I think it might be a jar package duplicate reference problem, but I can't find a place to repeat, and what should I do next, since quoting'com.facebook.react:react-native:0.17.1 compile.

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

Error when importing the project via git .I tried importing the project via git and executed the project and it gives me this error:
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
main:
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.ocpsoft:ocpsoft-pretty-time:1.0.6'
compile project(':facebook2')
compile 'jp.wasabeef:recyclerview-animators:1.2.0#aar'
compile 'jp.wasabeef:picasso-transformations:1.0.5'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okio:okio:1.0.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.nineoldandroids:library:2.4.0'
horizontal:
dependencies {
compile 'com.android.support:support-v4:18.+'
}
facebook:
dependencies {
compile 'com.android.support:support-v4:[21,22)'
compile 'com.parse.bolts:bolts-android:1.2.0'
}
You see where you have:
compile 'com.google.android.gms:play-services:7.5.0'
You are actually compiling all of Google's play services and that will often result in a mulidex error, meaning you have a whole lot of modules and code. It is best to only compile the API you need, for instance, if you want to use play service's location API just compile it this way:
compile 'com.google.android.gms:play-services-location:7.5.0'

Categories

Resources