Error with transformClassesWithDesugarForDebug

倾然丶 夕夏残阳落幕 提交于 2019-12-07 13:32:39

问题


I'm having trouble compiling an APK (debug or release).

Android Studio 3.0 Beta 5

This is my build.gradle (app)

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.my.package"
        minSdkVersion 15
        targetSdkVersion 26
        final MAJOR_RELEASE = 0
        final MINOR_RELEASE = 29
        versionCode getVersionCodeNumber(MAJOR_RELEASE, MINOR_RELEASE)
        versionName getVersionCodeName(MAJOR_RELEASE, MINOR_RELEASE)
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        proguardFiles fileTree(dir: 'proguard', include: ['*.pro']).asList().toArray()
    }

    signingConfigs {
       omitted
    }

    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            shrinkResources false
            signingConfig signingConfigs.releaseConfig
        }
        debug {
            debuggable true
            minifyEnabled false
            shrinkResources false
            versionNameSuffix '-DEBUG'
            signingConfig signingConfigs.debugConfig
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

afterEvaluate {
    assembleRelease.dependsOn testReleaseUnitTest
}

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

    //Testing
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:1.10.19'

    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support:support-annotations:26.0.2'

    implementation 'com.dadino.quickstart:core:0.3.11'

    //Support
    implementation 'com.android.support:support-v4:26.0.2'
    implementation 'com.android.support:design:26.0.2'
    implementation 'com.android.support:recyclerview-v7:26.0.2'
    implementation 'com.android.support:palette-v7:26.0.2'
    implementation 'com.android.support:cardview-v7:26.0.2'
    implementation 'com.android.support:support-v13:26.0.2'
    implementation 'com.android.support:appcompat-v7:26.0.2'
    implementation 'com.android.support:customtabs:26.0.2'

    //Square
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:okhttp:3.8.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'

    debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

    implementation 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

    //Google
    compile 'com.google.android.gms:play-services-gcm:10.2.1'
    compile 'com.google.android.gms:play-services-vision:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'

    //Firebase
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-config:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'

    //Requery
    implementation 'io.requery:requery:1.0.1'
    implementation 'io.requery:requery-android:1.0.1'
    annotationProcessor 'io.requery:requery-processor:1.0.1'

    //RxJava
    implementation 'io.reactivex:rxandroid:1.2.1'
    implementation 'io.reactivex:rxjava:1.3.0'
    implementation 'io.reactivex:rxjava-math:1.0.0'
    implementation 'com.artemzin.rxjava:proguard-rules:1.3.0.0'
    implementation 'com.jakewharton.rxbinding:rxbinding:1.0.1'
    implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0'
    implementation 'pl.charmas.android:android-reactive-location:0.10@aar'

    //UI
    implementation 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
    implementation 'com.wdullaer:materialdatetimepicker:3.0.0'

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


def getVersionCodeName(int major, int minor) {
    def versionCodeName = major * 100 + minor
    return "${versionCodeName}"
}

def getVersionCodeNumber(int major, int minor) {
    def versionCodeName = major * 100 + minor
    return versionCodeName
}




configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.2'
            }
        }

        if (requested.group == 'com.google.firebase' || requested.group == 'com.google.android.gms') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '11.2.2'
            }
        }
    }

    resolutionStrategy {
        force 'com.google.code.gson:gson:2.8.1'
    }
}

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

This is my build.gradle (project)

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta5'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven {
            url "http://dl.bintray.com/dadino/quickstart"
        }
        jcenter()
        google()
    }
}

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

This is the error I got when compiling

Information:Gradle tasks [:app:assembleDebug]
Error:java.lang.ClassNotFoundException: Class io.reactivex.Observable not found
Error:Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: 
Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments 
{--input /Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --output 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/desugar/debug/0 --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/0.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/1.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/2.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/3.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/4.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/5.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/6.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/7.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/8.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/9.jar --classpath_entry 
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/10.jar --classpath_entry 
 *all the same to 58.jar*
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/59.jar  --bootclasspath_entry 
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/android.jar --bootclasspath_entry 
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/optional/org.apache.http.legacy.jar --bootclasspath_entry 
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry 
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry 
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry 
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar --bootclasspath_entry 
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 15 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
Information:BUILD FAILED in 2s
Information:2 errors
Information:0 warnings
Information:See complete output in console

I've searched and read every page I could on desugar errors, but I can't find what's wrong with my project. I also don't understand why he's looking for io.reactivex.Observable and sometimes io.reactivex.Flowable, when I'm using RxJava1, not RxJava2.


回答1:


add android.enableD8.desugaring = true in gradle.properties file.



来源:https://stackoverflow.com/questions/46201268/error-with-transformclasseswithdesugarfordebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!