java.lang.VerifyError: Verifier rejected class j$.time.ZoneId:

java.lang.VerifyError: Verifier rejected class j$.time.ZoneId:

我无法确定可以使用什么 proguard/r8 配置来避免以下错误。

环境:

android { 
  compileSdkPreview = "android-S"
  defaultConfig {
    minSdk = 24
    targetSdk = 30
  }
  compileOptions { 
    isCoreLibraryDesugaringEnabled = true 
  } 
  buildType{
    getByName("release") {
      isDebuggable = false
      isMinifyEnabled = true
      isShrinkResources = true
  }
}
   
dependencies { 
  coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.0.9") 
}

我遇到以下运行时异常。

06-09 15:43:42.994 11747 11747 E AndroidRuntime: FATAL EXCEPTION: main
06-09 15:43:42.994 11747 11747 E AndroidRuntime: Process: com.example.myapp, PID: 11747
06-09 15:43:42.994 11747 11747 E AndroidRuntime: java.lang.VerifyError: Verifier rejected class j$.time.ZoneId: j$.time.ZoneId j$.time.ZoneId.q(java.lang.String, j$.time.ZoneOffset) failed to verify: j$.time.ZoneId j$.time.ZoneId.q(java.lang.String, j$.time.ZoneOffset): [0x10]  can't resolve returned type 'Reference: j$.time.ZoneId' or 'Unresolved Reference: j$.time.ZoneOffset'
06-09 15:43:42.994 11747 11747 E AndroidRuntime:  j$.time.ZoneId j$.time.ZoneId.r(java.lang.String, int, boolean) failed to verify: j$.time.ZoneId j$.time.ZoneId.r(java.lang.String, int, boolean): [0x3D] unexpected non-exception class Reference: a.b (declaration of 'j$.time.ZoneId' appears in /data/app/~~t4Hx1UMkLP0rmmxs6BLp2A==/com.example.myapp-gaznFp2vMqRsP8uHlL-Rpg==/base.apk!classes2.dex)

注:

如果将 -dontobfuscate 添加到 proguard/r8 配置文件,运行时错误就会消失。 显然这不是理想的,因此我的问题。

我将 desugar_jdk_libs 升级到 1.1.15,问题似乎已经解决了。

Changelog 还指出对错误的更改 类:

https://github.com/google/desugar_jdk_libs/blob/master/CHANGELOG.md