简体   繁体   English

d8 dex 编译因脱糖而失败

[英]d8 dex compilation fails with desugaring

I can't get d8 dex compiler to compile my jar package:我无法让 d8 dex 编译器编译我的 jar package:

$ wget https://repo1.maven.org/maven2/org/mockito/mockito-core/3.6.0/mockito-core-3.6.0.jar
$ java -jar d8_2.1.86.jar --output /tmp mockito-core-3.6.0.jar 2>&1 >/dev/null | grep "Compilation"
com.android.tools.r8.errors.CompilationError: Class or interface java.lang.RuntimeException required for desugaring of try-with-resources is not found.
Compilation failed

I tried to read about desugaring problems but couldn't get very far - what's wrong with this jar?我试图阅读有关脱糖问题的信息,但无法深入了解 - 这个 jar 有什么问题?

If you pass android.jar or the java runtime jar as --lib to your compilation you will not see that exception.如果您将 android.jar 或 java 运行时 Z68995--FCBF432492D15484D04A9 传递给您的编译,您将不会看到该异常。 There is, however, a lot of other warnings in your d8 compilation, because types that are needed for desugaring are not present.但是,在您的 d8 编译中还有很多其他警告,因为不存在脱糖所需的类型。 These are from dependencies of the mockito package that you don't have in your input or on classpath.这些来自您在输入或类路径中没有的 mockito package 的依赖项。 See also: https://developer.android.com/studio/command-line/d8#j8另请参阅: https://developer.android.com/studio/command-line/d8#j8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 捕获Java中未解决的编译错误 - Catch Unresolved Compilation Errors in Java 在PathClassLoader中的某些手机上无法加载Android应用 - Android app fails to load on some phones in PathClassLoader 二维数组时的运行时异常 - Runtime Exception while with 2d array 在第二个活动中调用时,Android无法连接到摄像头服务 - Android fails to Connect to camera service when called in a second activity 当用户密码失败时,Android拍照 - Android taking photo when user fails password 即使在抛出异常后,junit测试中的测试异常也会失败 - Testing Exception in junit tests fails even after the exception is thrown Unity3d Android应用因com.unity3d.player.ga上的NullPointerException崩溃 - Unity3d Android app crashes with NullPointerException at com.unity3d.player.g.a 2D arraylist NoSuchElementException - 2d arraylist NoSuchElementException OpenGL ES 2.0 2D图像显示 - OpenGL ES 2.0 2D-Image displaying java.lang.RuntimeException:无法为类型初始化效果引擎:0bed4300-ddd6-11db-8f34-0002a5d5c51b错误:-3 - java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM