使用 Facebook SDK 编译应用程序时出错

Error on compile app with Facebook SDK

我正在尝试将 Facebook 集成到我的 AOS 应用程序中,但出现此错误,我不知道如何修复它。

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

我修改了我的应用 | gradle 描述的文件 here

更新 此应用中使用的 Play 服务

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'

有什么想法吗? 谢谢,

我在使用 Facebook SDK 时遇到了同样的问题。这是解决方案:How to enable multidexing with the new Android Multidex support library.

我遇到了同样的问题。我通过删除不需要的播放服务来解决

//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'

具有 15 个以上支持库的播放服务,因此您必须只使用您想要的而不添加完整的播放服务

由 google 服务建议 点这里

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