sformClassesWithDesugarForDebug出

sformClassesWithDesugarForDebug出

本文介绍了transformClassesWithDesugarForDebug出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Android Studio 3.0 Beta 5

我无法编译APK(调试或发布)

这是我的 build.gradle (应用程序)

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

依赖项{
classpath'io.fabric.tools:gradle:1.+'
}
}

储存库{
maven { url'https://maven.fabric.io/public'}
}

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

android {
compileSdkVersion 26
buildToolsVersion26.0.1
defaultConfig {
applicationIdcom.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)
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
vectorDrawables.useSupportLibrary = true
proguardFiles getDefaultProguardFile('proguard-android.txt'),' 'proguard-rules.pro'
proguardFiles fileTree(dir:'proguard',include:['* .pro'])。asList()。toArray()
}

signedConfigs {
省略
}

buildTypes {
版本{
可调试虚假
minifyEnabled false
shrinkResources false
signedConfig signingConfigs.releaseConfig

debug {
debuggable true
minifyEnabled false
shrinkResources false
versionNameSuffix'-DEBUG'
signingConfig signingConfigs.debugConfig
}
}
co mpileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize4g
}
}

afterEvaluate {
assembleRelease.dependsOn testReleaseUnitTest
}

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

//测试
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'

//支持
实现'com.an droid.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
实现'com.squareup.retrofit2:retrofit:2.3.0'
实现'com.squareup.retrofit2:adapter-rxjava:2.3.0'
实现'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'
实现'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
编译'com.google.android.gms:play-services-gcm:10.2.1'
编译'com.google.android.gms:play-services -vision:10.2.1'
compile'c​​om.google.android.gms:play-services-location:10.2.1'

// Firebase
compile'c​​om。 google.firebase:firebase-core:10.2.1'
compile'c​​om.google.firebase:firebase-config:10.2.1'
compile'c​​om.google.firebase:firebase-messaging:10.2。 1'

//请求
实现'io.requery:requery:1.0.1'
实现'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
实现'com.github.rahatarmanahmed:circularprogressview:2.5.0'
实现'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
r eturn$ {versionCodeName}
}
$ b $ def 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'
}
}

套用插件:'com.google.gms.google-services'

这是我的 build.gradle (项目)

  buildscript {
repositories {
jcenter()
google()
}
依赖关系{
classpath'com.android.tools.build:gr adle:3.0.0-beta5'
classpath'com.google.gms:google-services:3.0.0'
}
}

allprojects {
repositories {
maven {urlhttps://jitpack.io}
maven {
urlhttp://dl.bintray.com/dadino/quickstart

jcenter()
google()
}
}

任务清理(类型:删除){
delete rootProject.buildDir





这是编译时得到的错误

 信息:Gradle任务[:app:assembleDebug] 
错误:java.lang.ClassNotFoundException:找不到类io.reactivex.Observable
错误:任务':app:transformClassesWithDesugarForDebug'的执行失败。
> com.android.build.api.transform.TransformException:java.lang.RuntimeException:java.lang.RuntimeException:com.android.ide.common.process.ProcessException:
使用主类com执行java进程时发生错误。 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 / dav idcorsalini / 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 /文件/ AndroidStudioProjects / controllori /应用/编译/中间tes / 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
*与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/主页/ jre / lib / charsets.jar --min_sdk_version 15 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
信息:BUILD中失败2s
信息:2错误
信息:0警告
信息:在控制台中查看完整的输出结果

我搜索并阅读了每一页,我可以在 desugar 错误,但是我找不到我的项目出了什么问题。我也不明白他为什么要寻找 io.reactivex.Observable ,有时 io.reactivex.Flowable ,我正在使用 RxJava1 ,而不是 RxJava2 。

解决方案
在gradle.properties文件中添加 android.enableD8.desugaring = true 。

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.

解决方案

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

这篇关于transformClassesWithDesugarForDebug出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 20:39