简体   繁体   English

Gradle错误“以非零值2完成”

[英]Gradle Error “finished with non-zero value 2”

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}
apply plugin: 'android'
apply plugin: 'crashlytics'

repositories {
    maven { url 'http://download.crashlytics.com/maven' }
}

dependencies {
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':Q-municate_core')
    compile project(':cropper')
    compile project(':stickyListHeaders')
    compile "com.nostra13.universalimageloader:universal-image-loader:${rootProject.universalImageLoaderVersion}"
    compile "com.google.android.gms:play-services:7.5.0"
    compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile "com.nineoldandroids:library:${rootProject.nineoldandroidsVersion}"
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
    compile 'com.crashlytics.android:crashlytics:1.+'

}

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion
    defaultConfig {
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode rootProject.versionCode
        versionName rootProject.versionName
    }
    buildTypes {
        release {
            debuggable rootProject.prodDebug
            signingConfig signingConfigs.debug
            minifyEnabled false
            proguardFile 'proguard.cfg'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    lintOptions {
        abortOnError false
    }
}

This is my build.gradle file I couldn't understand where I go wrong please help in this way. 这是我的build.gradle文件,我无法理解我哪里出错了,请以这种方式提供帮助。

when I compile this file I got the error 当我编译该文件时,出现错误

org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_72\bin\java.exe'' finished with non-zero exit value 2

I can't see your buildToolsVersion in the gradle. 我在gradle中看不到您的buildToolsVersion。 Have the latest build told version and also remove the unnecessary dependencies. 拥有最新版本的版本,并删除不必要的依赖项。

Follow this . 遵循这个

You added dependency in wrong gradle file. 您在错误的gradle文件中添加了依赖性。 see here two types of gradle 在这里看到两种类型的gradle

在此处输入图片说明

add dependency in build.gradle(Module : app) 在build.gradle(Module:app)中添加依赖项

and for understanding its feature use this link 为了了解其功能,请使用此链接

build.gradle(Module:app) have to be like this--> build.gradle(Module:app)必须像这样->

在此处输入图片说明

and project gradle file have to be like this ---> 和项目gradle文件必须是这样的--->

在此处输入图片说明

if any dependency you want to add then add in build.gradle(app) 如果要添加任何依赖项,则添加build.gradle(app)

It's because one of the libraries that you are adding contains a compile error. 这是因为要添加的库之一包含编译错误。 try to remove each time one library and compile, you can know than which of them is causing the error. 尝试每次删除一个库并进行编译时,就可以知道是哪个引起错误。

I think you should start with nineoldandroids library. 我认为您应该从nineoldandroids库开始。

This error is all about you have many huge libraries. 此错误仅与您拥有许多巨大的库有关。 So your method count is higher than 65k. 因此,您的方法计数大于65k。 It makes your dex file is large. 它使您的dex文件很大。 This is why you are taking a error while executing "dexDebug". 这就是为什么在执行“ dexDebug”时出错。

Solution is quite simple. 解决方法很简单。 You should implement Multidex. 您应该实现Multidex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM