安卓与摇篮(Java的完成非零退出值2) [英] Android with Gradle (Java finished with non-zero exit value 2)

查看:177
本文介绍了安卓与摇篮(Java的完成非零退出值2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的.gradle文件:

This is my .gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'

    compile 'com.mcxiaoke.volley:library:1.0.15'
    compile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.17'
}

当我尝试运行我的Andr​​oid应用程序,我得到了一个错误:

When I try to run my Android app, I get the next error:

错误:未能执行任务:应用程序:dexDebug

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'的/ usr /非成品的lib / JVM / Java为8甲骨文/斌/ Java的' - 零出口值2

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 2

我得到这个错误,当我加入到摇篮文件杰克逊库。 谷歌搜索一段时间后,我发现,杰克逊库与Android应用兼容,它比其他库,GSON更快。

I get this error when I add to gradle file the jackson library. Googling some time, I've found that jackson library is compatible with android apps, and It's faster than other libraries as gson.

我怎样才能解决呢? 我是一个Android初学者。

How I can solve it? I'm an Android beginner.

推荐答案

我想你应该改变你的Java JDK变化JVM V8的JDK7。此链接可以帮助你: <一href="http://stackoverflow.com/questions/23318109/is-it-possible-to-use-java-8-for-android-development">Is可以使用Java 8 Android开发?

I think you should change your java JDK change jvm v8 for jdk7. This link can help you: Is it possible to use Java 8 for Android development?

其他可能的问题,其相关性错误,构建之前干净的摇篮。并更改杰克逊库这样的:

Other possible issue its dependency error, clean gradle before build. And change your jackson library for this:

compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'

这篇关于安卓与摇篮(Java的完成非零退出值2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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