【问题标题】:java.exe finished with non-zero exit value 2 when using Facebook SDKjava.exe 在使用 Facebook SDK 时以非零退出值 2 结束
【发布时间】:2015-03-13 09:25:36
【问题描述】:

当我尝试编译我的应用程序时,出现以下错误

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.7.0_60\bin\java.exe'' finished with non-zero exit value 2

如果我摆脱 Facebook Android SDK,它编译不会有问题。

我的 build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21 //tried 19 and 22 changing targetSdkVersion and buildToolsVersion accordingly
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "..."
        minSdkVersion 15
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

...

}

dependencies {
    ...
    compile 'com.facebook.android:facebook-android-sdk:3.23.1' //tried older versions as well
}

【问题讨论】:

标签: java android gradle android-gradle-plugin facebook-android-sdk


【解决方案1】:

首先,您应该尝试使用gradle :MODULE:dependencies 列出您的依赖项 检查是否存在库冲突(相同的库但版本不同)。在这种情况下,我认为您应该从 Facebook SDK 中排除支持库模块。

compile ('com.facebook.android:facebook-android-sdk:3.23.1'){
        exclude group: 'com.google.android', module: 'support-v4'
    }

【讨论】:

  • 15 并接受?为什么 ?这是我排除时的错误:DSL NOT FOUND EXCLUDE
【解决方案2】:

在使用 Facebook SDK 项目库时,Pawel 的解决方案对我有用。

但是在我迁移到 Gradle 依赖项 'com.facebook.android:facebook-android-sdk:4.1.1' 后它停止工作。尝试重建/重新打开项目,但没有任何帮助。

这对我有用:

compile ('com.facebook.android:facebook-android-sdk:4.1.1') {
    exclude module: 'support-v4'
}

【讨论】:

  • 这对我有用:compile ('com.facebook.android:facebook-android-sdk:4.1.1') { exclude module: 'support-v4' }
猜你喜欢
  • 2015-07-11
  • 1970-01-01
  • 1970-01-01
  • 2016-03-21
  • 2016-04-02
  • 2015-12-27
  • 2015-08-01
  • 2015-07-12
  • 2015-08-28
相关资源
最近更新 更多