Error on compile app with Facebook SDK

2019-07-18 17:00发布

I'm trying to integrate Facebook in my AOS app and I'm getting this error that I can't figure out how to fix it.

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.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

I modified my app | gradle file as described here

UPDATE Play Services used in this app

compile 'com.google.android.gms:play-services:8.4.0' compile 'com.google.android.gms:play-services-ads:8.4.0' compile 'com.google.android.gms:play-services-identity:8.4.0' compile 'com.google.android.gms:play-services-gcm:8.4.0'

Any ideas? Thanks,

2条回答
别忘想泡老子
2楼-- · 2019-07-18 17:36

I had the same problem when worked with Facebook SDK. This is solution: How to enable multidexing with the new Android Multidex support library.

查看更多
Juvenile、少年°
3楼-- · 2019-07-18 17:40

I faced the same issue . I solve by by removing unwanted play services

//compile 'com.google.android.gms:play-services:8.4.0'
//Don't use play services directly. use only what ever you want
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

Play services having 15+ support libs so you have to use only what you want dont add full play services

Suggested by google service Check Here

Selectively compiling APIs into your executable

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:

compile 'com.google.android.gms:play-services:8.4.0'

with these lines:

compile 'com.google.android.gms:play-services-fitness:8.4.0'

compile 'com.google.android.gms:play-services-wearable:8.4.0'

shows a list of the separate APIs that you can include when compiling your app, and how to describe them in your build.gradle file. Some APIs > do not have a separate library; include them by including the base library. (This lib is automatically included when you include an API that does have a separate library.)

查看更多
登录 后发表回答