Gradle Build failed with an exception : java.exe' finished with non-zero exit value 2

前端 未结 3 578
栀梦
栀梦 2021-01-17 03:08

build.gradle file:

android {
    compileSdkVersion 22
    buildToolsVersion \"22.0.1\"

    defaultConfig {
        applicationId \"xxxxx.com.myapp\"
                


        
相关标签:
3条回答
  • 2021-01-17 03:38

    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.

    0 讨论(0)
  • 2021-01-17 03:42

    Sometimes this build failed error occures due to multidex problem. As per looking into your build script it does not seems that you need multidex enabling ture. But still you can try this because I can not say much just seeing your gradle build script.Use

        defaultConfig {
                applicationId "xxxxx.com.myapp"
                minSdkVersion 9
                targetSdkVersion 22
                versionCode 3
                versionName "1.2"
                // enable Mutidex.
                multiDexEnabled true
    
    
            }
    
    0 讨论(0)
  • 2021-01-17 03:50

    You are including libGoogleAnalyticsServices.jar twice. Based in the path, it will be include by the following line (which includes all jars in the libs directory) --

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

    remove this line to avoid including the lib twice --

    compile files('libs/libGoogleAnalyticsServices.jar')
    
    0 讨论(0)
提交回复
热议问题