摇篮构建失败,出现异常:java.exe的“完成非零值2 [英] Gradle Build failed with an exception : java.exe' finished with non-zero exit value 2

查看:142
本文介绍了摇篮构建失败,出现异常:java.exe的“完成非零值2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

build.gradle文件:

 安卓{
    compileSdkVersion 22
    buildToolsVersion22.0.1

    defaultConfig {
        的applicationIDxxxxx.com.myapp
        的minSdkVersion 9
        targetSdkVersion 22
        版本code 3
        VERSIONNAME1.2


    }
    buildTypes {
        推出 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'proguard-rules.pro
        }
    }
}

依赖{
    编译文件树(导演:库,包括:['的* .jar'])
    编译com.android.support:appcompat-v7:22.1.1
    编译com.google.android.gms:播放服务,广告:7.3.0
    编译文件(库/ libGoogleAnalyticsServices.jar)
}
 

错误日志:

失败:建立失败,一个异常

  • 出了什么问题: 执行失败的任务:应用程序:dexDebug。
      

    com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'C:\ Program Files文件\的Java \ jdk1.7.0_51 \斌\ java.exe的''完成非零退出值2

解决方案

试着移除你的依赖以下内容:

 编译文件树(导演:库,包括:['的* .jar'])
编译文件(库/ libGoogleAnalyticsServices.jar)
 

如果你看一下这里,Analytics(分析)API已建成谷歌播放服务,因此两者是相互矛盾的。

build.gradle file:

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "xxxxx.com.myapp"
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 3
        versionName "1.2"


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services-ads:7.3.0'
    compile files('libs/libGoogleAnalyticsServices.jar')
}

Error Log:

FAILURE: Build failed with an exception.

  • What went wrong: 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_51\bin\java.exe'' finished with non-zero exit value 2

解决方案

Try removing the following from your dependencies:

compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/libGoogleAnalyticsServices.jar')

If you look here, the Analytics API is already built into Google play services, so the two are conflicting.

这篇关于摇篮构建失败,出现异常:java.exe的“完成非零值2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆