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.
Related
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.
How to resolve this error while compiling google play service gcm and admob.
Error:Execution failed for task ':processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0[enter image description here][1]
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.3'
compile "com.android.support:appcompat-v7:22.2.1"
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
This will probably vanish if you use the same version on both (7.8.0)
compile 'com.google.android.gms:play-services-gcm:7.8.0' // <- remove this line
compile 'com.google.android.gms:play-services:6.5.87'
There is already 8.1+ though.
Also:
Gcm is already in the play services, you can remove the whole line.
Clone the project https://github.com/googlesamples/google-services/tree/master/android/gcm and everything works perfectly.
When I try to add the module "App Engine Backend with Google Cloud Messaging" with the wizard I get the following error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.transform.api.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Now I try to add this in my build.gradle defaultConfig
multiDexEnabled true
and clean the project and recompile. But I always get the same error. Finally I try to delete the form from the project (thinking to resume normal functioning) but I get the following error:
Installing gcm.play.android.samples.com.gcmquickstart
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/gcm.play.android.samples.com.gcmquickstart"
pkg: /data/local/tmp/gcm.play.android.samples.com.gcmquickstart
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.example.gcm.permission.C2D_MESSAGE pkg=it.elipse.tnttrackingapp]
DEVICE SHELL COMMAND: pm uninstall gcm.play.android.samples.com.gcmquickstart
DELETE_FAILED_INTERNAL_ERROR
Could someone help me? to you taking the same steps you find yourself in my situation? Thank you in advance
SOLVED
Hi guys i've found by myself the answer. I hope that it can be helpfull for someone with the same problem.
When Android Studio generates the backend module, adds this line at the end of dependencies of your build.gradle(Module:app)
compile project(path: ':backend', configuration: 'android-endpoints')
And you have something like this :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
The workaround is to move the auto-generated line on the top of dependecies declaration, like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
}
UPDATE
If you do not solve try:
Build->Make Project
Build->Make Module 'app'
Build->Clean Project
Build->Rebuild Project
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'
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.