transformClassesWithDesugar build error after updating to AS 3.0 Canary 6

后端 未结 7 496
抹茶落季
抹茶落季 2020-12-06 03:56

I updated to Android Studio 3.0 Canary 6 and am now getting following error (had been on Canary 5). I\'ve searched for people seeing similar issues but no luck so far. Any

相关标签:
7条回答
  • 2020-12-06 04:32

    For me, it happened with AS3.0 stable, with classfiles from previous beta version. The solution was to do a Build -> Clean Project.

    0 讨论(0)
  • 2020-12-06 04:36

    For those who encounter this problem on an ionic or cordova project this command will help you:

    cordova clean android

    0 讨论(0)
  • 2020-12-06 04:39

    With Android Studio 3.1, com.android.tools.build:gradle:3.1.0 and gradle-4.4-all.zip this issue resolving with adding

    android.enableD8.desugaring = true

    in gradle.properties file.

    0 讨论(0)
  • 2020-12-06 04:39

    Have you tried https://github.com/gradle/gradle/issues/2384#issuecomment-376793947 ?

    Try adding android.enableD8.desugaring = true in gradle.properties and you may need to add proguard rule -dontwarn java.lang.invoke**

    0 讨论(0)
  • 2020-12-06 04:41

    This seems to be a gradle bug.
    Just update your gradle (/gradle/wapper/gradle-wapper.properties) manually and try build again to find more helpful infomation.


    Here is how I solved my problem as this may be helpful.

    I'm using AndroidStudio 3.0.1 with embedded gradle 4.1-all (Newly installed), and a project which worked fine yesterday.

    I guess it's a Gradle problem so I upgraded my Gradle wapper manually to 4.4.1-all (2017/12/29, the last release version in http://services.gradle.org/distributions/), then cleaned and built again.

    Sadly, this exception appeared again, but with more information:

    Error:注: [1] Wrote GeneratedAppGlideModule with: []
    警告: C:\Users\23256\.gradle\caches\modules-2\files-2.1\org.jooq\joor\0.9.7\dab4ea4a43112773b593c898df9fbfb19c42ac3b\joor-0.9.7.jar(org/joor/Reflect.class): 主版本 53 比 52 新, 此编译器支持最新的主版本。
    建议升级此编译器。
    警告: C:\Users\23256\.gradle\caches\modules-2\files-2.1\org.jooq\joor\0.9.7\dab4ea4a43112773b593c898df9fbfb19c42ac3b\joor-0.9.7.jar(org/joor/ReflectException.class): 主版本 53 比 52 新, 此编译器支持最新的主版本。
    建议升级此编译器。
    注: 某些输入文件使用或覆盖了已过时的 API。
    注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
    2 个警告
    Exception in thread "main" java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at com.google.devtools.build.android.desugar.CoreLibraryRewriter.reader(CoreLibraryRewriter.java:44)
        at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:388)
        at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
        at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
        at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
    FAILURE: Build failed with an exception.
    * What went wrong:
    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...
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 11s
    

    This message helped me to fix the problem: I'm using jooR in my project, and it told me something's wrong with it, so I checked http://mvnrepository.com/search?q=joor, found it has split into 2 projects, so I replaced my dependencies like this:

    -    //https://bintray.com/bintray/jcenter/org.jooq%3Ajoor
    -    //https://github.com/jOOQ/jOOR
    -    api 'org.jooq:joor:0.9.7'
    +    // https://mvnrepository.com/artifact/org.jooq/joor-java-8
    +    api group: 'org.jooq', name: 'joor-java-8', version: '0.9.7'
    

    Clean and build, and it now passes.

    0 讨论(0)
  • 2020-12-06 04:43

    I had that issue when moved to Android Studio 3.0

    Ensure that you have same versions of firebase-core and play-services, e.g.:

     compile 'com.google.android.gms:play-services-ads:11.0.4'
     compile 'com.google.firebase:firebase-core:11.0.4'
    
    0 讨论(0)
提交回复
热议问题