Java 以非零退出值 2 结束 - Android Gradle [英] Java finished with non-zero exit value 2 - Android Gradle

查看:55
本文介绍了Java 以非零退出值 2 结束 - Android Gradle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行我的 Android 应用程序时遇到此错误(我清理了它然后构建了它,但错误仍然存​​在)

I'm getting this error executing my Android app (I cleaned it and then built it, but the error is still present)

  • 同步:好的
  • 制作项目:好的
  • 干净:好的
  • 运行:错误

错误:任务 ':app:dexDebug' 的执行失败 .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdk1.7.0_25injava.exe'' 以非零退出值 2 结束

Error:Execution failed for task ':app:dexDebug' .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdk1.7.0_25injava.exe'' finished with non-zero exit value 2

我的gradle文件:

My gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
    applicationId "com.rzr.rzevallosr.miappdepruebas"
    minSdkVersion 19
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

productFlavors {
}

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta9@aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta9@aar'

compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.+'

compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'

compile files('libs/spotify-web-api-android-master-0.1.0.jar')
compile files('libs/okio-1.3.0.jar')
}

我没有看到compile fileTree(dir: 'libs', include: ['*.jar'])"它正在编译我的库两次,所以我只是评论:

I didn't see "compile fileTree(dir: 'libs', include: ['*.jar'])" it was compiling twice my libraries, so i just comment:

//compile 'com.squareup.retrofit:retrofit:1.9.0'
//compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
//compile 'com.squareup.okhttp:okhttp:2.2.0'

//compile files('libs/spotify-web-api-android-master-0.1.0.jar')
//compile files('libs/okio-1.3.0.jar')

它工作正常.

推荐答案

我不知道(那时)"compile fileTree(dir: 'libs', include: ['*.jar']) 编译所有在 libs 文件夹上有 jar 扩展名的文件,所以我只是注释(或删除)这几行:

I didn't know (by then) that "compile fileTree(dir: 'libs', include: ['*.jar'])" compile all that has jar extension on libs folder, so i just comment (or delete) this lines:

//compile 'com.squareup.retrofit:retrofit:1.9.0'
//compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
//compile 'com.squareup.okhttp:okhttp:2.2.0'

//compile files('libs/spotify-web-api-android-master-0.1.0.jar')
//compile files('libs/okio-1.3.0.jar')

而且它工作正常.不管怎么说,还是要谢谢你!我的错.

and it works fine. Thanks anyway! My bad.

这篇关于Java 以非零退出值 2 结束 - Android Gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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