title: IllegalStateException: failed to analyze: java.lang.AssertionError: annotation tree hasn't been attributed yet: @kotlin.Metadata
body: <p>We get the following build error when updating from Kotlin 1.3.21 to 1.3.30+ in Android Studio 3.4.1:</p>
  
  <pre><code>e: java.lang.IllegalStateException: failed to analyze: java.lang.AssertionError: annotation tree hasn't been attributed yet: @kotlin.Metadata(mv = {1, 1, 15}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b&amp;\u0018\u0000*\b\b\u0000\u0010\u0001*\u00020\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0003B\u001f\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0001\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t\u00a2\u0006\u0002\u0010\n\u00a8\u0006\u000b"}, d2 = {"Lde/thermomess/field/ui/viewholder/BaseViewHolder;", "T", "", "Lcom/xroot/android/ui/recyclerview/RecyclerViewHolder;", "context", "Landroid/content/Context;", "layoutResId", "", "parent", "Landroid/view/ViewGroup;", "(Landroid/content/Context;ILandroid/view/ViewGroup;)V", "app_betaDebug"})
  </code></pre>
  
  <p>Everything behind @kotlin.Metadata differs but before that it stays the same. With Kotlin 1.3.21 and older everything is working fine.</p>
  
  <p>We use the @kotlin.Metadata for checking whether a class is a Kotlin class for a Gson TypeAdapterFactory</p>
  
  <pre><code>private val Class&lt;*&gt;.isKotlinClass: Boolean
      get() = declaredAnnotations.find { it.annotationClass.java.name == "kotlin.Metadata" } != null
  </code></pre>
  
  <p>and for skipping custom annotations via obfuscation rules</p>
  
  <pre><code>-keep class kotlin.Metadata { *; }
  -keepclassmembers @kotlin.Metadata class * {
      &lt;methods&gt;;
  }
  </code></pre>
  
  <p>but even if we remove these usages, the error stays the same.</p>
  
  <p>How do we fix this error?</p>
  
  <p>build.gradle</p>
  
  <pre><code>dependencies {
      classpath 'com.android.tools.build:gradle:3.4.1'
      classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31'
      classpath 'io.objectbox:objectbox-gradle-plugin:2.3.4'
  }
  </code></pre>
  
  <p>app/build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android-extensions'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-kapt'
  apply plugin: 'io.objectbox'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          ...
          minSdkVersion 16
          targetSdkVersion 28
          vectorDrawables.useSupportLibrary = true
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
  
      compileOptions {
          targetCompatibility 1.8
          sourceCompatibility 1.8
      }
  }
  
  dependencies {
      implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31'
      implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.31'
      ...
  }
  </code></pre>