Android Build Tools 3.1.1失败构建完成时非零退出值1

时间:2018-04-10 09:40:02

标签: android android-studio kotlin android-gradle

当我将Android Studio更新为3.1.1版本时,出现finished with non-zero exit value 1错误。我发现它与com.android.tools.build:gradle有问题,因为当我切换回3.0.1构建成功完成时。

app build.gradle

plugins {
    id "io.github.rockerhieu.versionberg" version "1.0.0"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.github.triplet.play'

versionberg {
    major 1
    minor 0
    nameTemplate '${major}.${minor}.0'
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    //noinspection GroovyMissingReturnStatement
    defaultConfig {
        applicationId "com.app.appid"

        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        multiDexEnabled true

        versionCode versionberg.code
        versionName "1.0.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        renderscriptTargetApi 25
        renderscriptSupportModeEnabled false

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        abortOnError false
    }

    kapt {
        generateStubs = true
        mapDiagnosticLocations = true
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        debug {
            ext.enableCrashlytics = false
            ext.betaDistributionNotifications = false

            applicationIdSuffix ".debug"

        }

        qa {
            ext.betaDistributionNotifications = false

            applicationIdSuffix ".qa"

            signingConfig signingConfigs.qa

        }

        release {
            ext.betaDistributionNotifications = false

            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

        android.applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "${getAppName()}_${defaultConfig.versionName}-${defaultConfig.versionCode}(${variant.buildType.name}).apk"
            }
        }

    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/rxjava.properties'
        exclude 'org/joda/time/format/*.properties'
    }
}

def getAppName() {
    def stringsFile = android.sourceSets.main.res.sourceFiles.find { it.name.equals 'strings.xml' }
    return new XmlParser().parse(stringsFile).string.find { it.@name.equals 'app_name' }.text()
}

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation "junit:junit:$rootProject.junitLibraryVersion"
    testImplementation "org.mockito:mockito-core:$rootProject.mockitoCoreLobraryVersion"
    testImplementation "org.robolectric:robolectric:$rootProject.robolectricLibraryVersion"

    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.supportLibraryVersion"
    implementation "com.android.support:palette-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support.constraint:constraint-layout:" +
            "$rootProject.constraintLayoutLibraryVersion"

    implementation "android.arch.lifecycle:extensions:1.1.1"

    implementation "com.google.firebase:firebase-core:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-database:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-storage:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-perf:$rootProject.firebaseLibraryVersion"

    implementation "com.firebaseui:firebase-ui-database:$rootProject.firebaseUiLibraryVersion"
    implementation "com.firebaseui:firebase-ui-storage:$rootProject.firebaseUiLibraryVersion"

    implementation 'com.firebase:firebase-jobdispatcher:0.8.2'

    implementation "com.google.android.gms:play-services-maps:$rootProject.playServicesLibraryVersion"
    implementation "com.google.android.gms:play-services-location:$rootProject.playServicesLibraryVersion"

    implementation "com.google.android:flexbox:$rootProject.flexboxLibraryVersion"
    implementation 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2'
    kapt "com.android.databinding:compiler:$android_tools_version"

    implementation "com.google.android:flexbox:$rootProject.flexboxLibraryVersion"
    implementation 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2'

    implementation "com.github.bumptech.glide:glide:$rootProject.glideLibraryVersion"
    kapt "com.github.bumptech.glide:compiler:$rootProject.glideLibraryVersion"
    implementation "com.github.bumptech.glide:okhttp3-integration:" +
            "$rootProject.glideLibraryVersion"

    implementation('jp.wasabeef:glide-transformations:3.0.1') {
        exclude group: 'com.github.bumptech.glide', module: 'glide'
    }

    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttpLibraryVersion"

    implementation "com.google.code.gson:gson:2.8.2"

    implementation 'com.squareup.moshi:moshi:1.5.0'

    implementation 'com.jakewharton.timber:timber:4.5.1'

    implementation "com.github.akarnokd:rxjava2-interop:0.10.0"

    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }
    implementation('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true
    }

    compile project(':libmediapicker')
    compile project(':libhorizontalpicker')
    compile project(':librangebar')
    compile project(':libsignature')

    implementation 'nz.bradcampbell:paperparcel:2.0.1'
    implementation 'nz.bradcampbell:paperparcel-kotlin:2.0.1'
    kapt 'nz.bradcampbell:paperparcel-compiler:2.0.1'

    implementation "net.danlew:android.joda:$rootProject.jodaTimeLibraryVersion"

    implementation "com.arello-mobile:moxy:$rootProject.moxyLibraryVersion"
    implementation "com.arello-mobile:moxy-app-compat:$rootProject.moxyLibraryVersion"
    kapt "com.arello-mobile:moxy-compiler:$rootProject.moxyLibraryVersion"

    // Dagger core dependencies
    implementation "com.google.dagger:dagger:$rootProject.daggerLibraryVersion"
    kapt "com.google.dagger:dagger-compiler:$rootProject.daggerLibraryVersion"
    implementation "com.google.dagger:dagger-android:$rootProject.daggerLibraryVersion"
    implementation "com.google.dagger:dagger-android-support:$rootProject.daggerLibraryVersion"
    kapt "com.google.dagger:dagger-android-processor:$rootProject.daggerLibraryVersion"

    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    implementation "io.reactivex:rxjava:$rootProject.rxJavaLibraryVersion"
    implementation "io.reactivex:rxandroid:$rootProject.rxAndroidLibraryVersion"

    implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxKotlinLibraryVersion"
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidV2LibraryVersion"

    implementation "com.github.VictorAlbertos:RxActivityResult:$rootProject.rxActivityResult2LibraryVersion"
    implementation "com.tbruyelle.rxpermissions2:rxpermissions:$rootProject.rxPermissionsLibraryVersion"
    implementation "com.github.miguelbcr:RxPaparazzo:$rootProject.rxPaparazzoLibraryVersion"

    implementation "com.f2prateek.rx.preferences:rx-preferences:$rootProject.rxPreferencesLibraryVersion"
    implementation "com.f2prateek.rx.preferences2:rx-preferences:$rootProject.rxPreferences2LibraryVersion"

    implementation "com.jakewharton.rxbinding:rxbinding-appcompat-v7:$rootProject.rxBindingLibraryVersion"
    implementation "com.jakewharton.rxbinding:rxbinding-support-v4:$rootProject.rxBindingLibraryVersion"

    implementation "com.pushtorefresh.storio:sqlite:$rootProject.storioLibraryVersion"
    implementation "com.pushtorefresh.storio:sqlite-annotations:$rootProject.storioLibraryVersion"
    kapt "com.pushtorefresh.storio:sqlite-annotations-processor:$rootProject.storioLibraryVersion"

    implementation "im.ene.toro3:toro:3.3.0"
    implementation "im.ene.toro3:toro-ext-exoplayer:3.3.0"  // to get ExoPlayer support
    implementation 'com.thoughtbot:expandablerecyclerview:1.3'
    implementation 'com.github.chrisbanes:PhotoView:1.3.1'
    implementation 'com.github.barteksc:android-pdf-viewer:2.4.0'
    implementation 'me.grantland:autofittextview:0.2.1'

    implementation "com.jsqix.dq.indicator:monindicator:$rootProject.monIndicatorLibraryVersion"

    implementation 'ca.barrenechea.header-decor:header-decor:0.2.8'

    implementation 'org.apache.commons:commons-lang3:3.0'

    implementation 'com.github.adrielcafe:AndroidAudioRecorder:0.2.0'

    implementation 'com.tonicartos:superslim:0.4.13'

    implementation 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'

    //Development
    implementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    implementation 'com.facebook.stetho:stetho:1.4.2'
    implementation 'com.facebook.stetho:stetho-okhttp3:1.4.2'

    debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'

    // intercom
    implementation 'io.intercom.android:intercom-sdk-base:4.0.0'
    implementation 'io.intercom.android:intercom-sdk-fcm:4.0.0'

    implementation('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true
    }
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation "org.jetbrains.anko:anko-commons:$rootProject.anko_version"

    implementation 'com.flaviofaria:kenburnsview:1.0.7'


    implementation 'com.yayandroid:ParallaxRecyclerView:1.1'

    implementation 'pl.charmas.android:android-reactive-location:0.10@aar'

    implementation 'com.edmodo:cropper:1.0.1'

    implementation "me.zhanghai.android.materialprogressbar:library:$rootProject.materialprogressbarLibraryVersion"

    implementation 'com.kyleduo.switchbutton:library:1.4.6'

    implementation "net.danlew:android.joda:$rootProject.jodaTimeLibraryVersion"

    implementation 'com.github.aakira:expandable-layout:1.6.0@aar'
    implementation 'com.github.aakira:expandable-layout:1.6.0@aar'

    implementation 'jp.wasabeef:recyclerview-animators:2.2.7'

    implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'

    // Barcode scanner library
    implementation 'me.dm7.barcodescanner:zxing:1.9.8'

    // Signature lib
    implementation 'com.github.gcacace:signature-pad:1.2.1'

    implementation 'com.github.markomilos:paginate:0.5.1'

    // View pager circular indicator
    implementation 'me.relex:circleindicator:1.2.2@aar'

    implementation 'com.airbnb.android:lottie:2.3.1'

    implementation 'com.afollestad:easyvideoplayer:0.3.0'

    implementation 'com.danikula:videocache:2.7.0'

    implementation 'jp.wasabeef:blurry:2.1.1'

    implementation 'io.supercharge:shimmerlayout:2.0.0'

    implementation('com.giphy.sdk:core:1.0.2@aar') {
        transitive = true
    }

}

apply plugin: 'com.google.gms.google-services'

root build.gradle

buildscript {

    ext.kotlin_version = '1.2.31'
    ext.android_tools_version = '3.1.1'

    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$android_tools_version"
        classpath 'com.google.gms:google-services:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:firebase-plugins:1.1.1'
        classpath 'io.fabric.tools:gradle:1.22.1'
        classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://dl.bintray.com/drummer-aidan/maven" }
        maven { url "https://giphy.bintray.com/giphy-sdk" }
        mavenCentral()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    // Sdk and tools
    minSdkVersion = 21
    targetSdkVersion = 27
    compileSdkVersion = 27
    buildToolsVersion = '27.0.3'

    // App dependencies
    supportLibraryVersion = '27.1.0'
    constraintLayoutLibraryVersion = '1.0.2'
    playServicesLibraryVersion = '11.8.0' /* https://developers.google.com/android/guides/setup */
    firebaseLibraryVersion = playServicesLibraryVersion
    flexboxLibraryVersion = '0.3.1' /* https://github.com/google/flexbox-layout/releases */
    gsonLibraryVersion = '2.8.1' /* https://github.com/google/gson/releases */
    daggerLibraryVersion = '2.14.1' /* https://github.com/google/dagger/releases */
    retrofitLibraryVersion = '2.3.0' /* https://github.com/square/retrofit/releases */
    okHttpLibraryVersion = '3.8.0' /* https://github.com/square/okhttp/releases */
    moxyLibraryVersion = '1.5.3' /* https://github.com/Arello-Mobile/Moxy/releases */
    firebaseUiLibraryVersion = '3.1.0' /* https://github.com/firebase/FirebaseUI-Android/releases */
    lightweightStreamLibraryVersion = '1.1.4'
    monIndicatorLibraryVersion = '1.0.0'
    storioLibraryVersion = '1.13.0' /* https://github.com/pushtorefresh/storio/releases */
    storioLibraryVersion2 = '2.0.0' /* https://github.com/pushtorefresh/storio/releases */
    glideLibraryVersion = '4.3.1'
    glideOkhttp3IntegrationLibraryVersion = '1.4.0@aar'
    rxJavaLibraryVersion = '1.3.3' /* https://github.com/ReactiveX/RxJava/releases */
    rxJavaV2LibraryVersion = '2.1.6' /* https://github.com/ReactiveX/RxJava/releases */
    rxAndroidLibraryVersion = '1.2.1' /* https://github.com/ReactiveX/RxAndroid/releases */
    rxAndroidV2LibraryVersion = '2.0.1' /* https://github.com/ReactiveX/RxAndroid/releases */
    rxKotlinLibraryVersion = '2.1.0' /* https://github.com/ReactiveX/RxKotlin/releases */
    rxBindingLibraryVersion = '1.0.0'
    rxPreferencesLibraryVersion = '1.0.2'
    rxPreferences2LibraryVersion = '2.0.0-RC3'
    rxActivityResult2LibraryVersion = '0.4.5-2.x'
    /* https://github.com/VictorAlbertos/RxActivityResult/releases */
    rxPermissionsLibraryVersion = '0.9.4@aar'
    /* https://github.com/tbruyelle/RxPermissions/releases */
    rxPaparazzoLibraryVersion = '0.6.0-2.x' /* https://github.com/miguelbcr/RxPaparazzo/releases */
    materialprogressbarLibraryVersion = '1.4.1'
    jodaTimeLibraryVersion = '2.9.9'

    junitLibraryVersion = '4.12'
    mockitoCoreLobraryVersion = '1.9.5'
    robolectricLibraryVersion = '3.0'

    timberLibraryVersion = '4.5.1' /* https://github.com/JakeWharton/timber/releases */
    anko_version = '0.10.1' /* https://github.com/Kotlin/anko/releases */
}

gradle.properties

org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8
kotlin.incremental=true
org.gradle.parallel=true
org.gradle.caching=true
android.enableBuildCache=true
android.enableD8=true

我试过了:

  • 从嵌入式jdk更改jdkopen jdk 8oracle jdk 10
  • 删除android.enableD8=truekapt "com.android.databinding:compiler:$android_tools_version"
  • 清除/构建并使缓存无效/重新启动

没有任何帮助:(

1 个答案:

答案 0 :(得分:0)

当我删除

时,我发现问题是desugar java 8
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

已转换的具有java 8个功能的类已成功构建到kotlin项目。