title: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/Math8 when upgrading Gradle and Android Gradle Plugin
body: <p>I'm working on an Android app with a Gradle version of <code>7.1.1</code> and an Android Gradle Plugin version of <code>7.0.0</code>. When I upgrade to Gradle version <code>7.2</code> and Android Gradle Plugin version <code>7.1.1</code>, I get the following error.</p>
  <pre><code>2022-03-02 17:15:47.072 25300-25300/... E/AndroidRuntime: FATAL EXCEPTION: main
      Process: ..., PID: 25300
      java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/Math8;
          at j$.time.Instant.ofEpochSecond(Instant.java:328)
          at j$.time.Instant.&lt;clinit&gt;(Instant.java:232)
          at j$.time.Instant.ofEpochMilli(Instant.java:344)
          ...
          at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
          at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
          at android.os.Handler.handleCallback(Handler.java:883)
          at android.os.Handler.dispatchMessage(Handler.java:100)
          at android.os.Looper.loop(Looper.java:214)
          at android.app.ActivityThread.main(ActivityThread.java:7356)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
       Caused by: java.lang.ClassNotFoundException: Didn't find class &quot;java.lang.Math8&quot; on path: DexPathList[[zip file &quot;/data/app/...-NbMXeOj8LumN03n4IMK5Cw==/base.apk&quot;],nativeLibraryDirectories=[/data/app/...-NbMXeOj8LumN03n4IMK5Cw==/lib/x86, /data/app/...-NbMXeOj8LumN03n4IMK5Cw==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
          at j$.time.Instant.ofEpochSecond(Instant.java:328) 
          at j$.time.Instant.&lt;clinit&gt;(Instant.java:232) 
          at j$.time.Instant.ofEpochMilli(Instant.java:344) 
          ...
          at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
          at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
          at android.os.Handler.handleCallback(Handler.java:883) 
          at android.os.Handler.dispatchMessage(Handler.java:100) 
          at android.os.Looper.loop(Looper.java:214) 
          at android.app.ActivityThread.main(ActivityThread.java:7356) 
          at java.lang.reflect.Method.invoke(Native Method) 
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
  </code></pre>
  <p>The error is coming from this code:</p>
  <pre class="lang-kotlin prettyprint-override"><code>fun toLocalStartOfDay(date: Long): Instant = Instant.ofEpochMilli(date)
      .atZone(ZoneId.systemDefault())
      .withHour(0)
      .withMinute(0)
      .withSecond(0)
      .withNano(0)
      .toInstant()
  </code></pre>
  <p>The <code>build.gradle</code> file is set to target JVM 1.8 with desugaring.</p>
  <pre><code>compileOptions {
      coreLibraryDesugaringEnabled = true
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  
  kotlinOptions {
      jvmTarget = '1.8'
  }
  </code></pre>
  <p>The <code>desugar_jdk_libs</code> version is set to <code>1.0.9</code>.</p>
  <pre><code>versions.androidDesugaringVersion = '1.0.9'
  support.android_desugaring = &quot;com.android.tools:desugar_jdk_libs:$versions.androidDesugaringVersion&quot;
  </code></pre>
  <p>Why would upgrading cause this error?</p>