Error on compile app with Facebook SDK

瘦欲@ 提交于 2019-12-24 02:06:06

问题


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,


回答1:


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.)




回答2:


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



来源:https://stackoverflow.com/questions/36603289/error-on-compile-app-with-facebook-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!