title: Installing app takes minutes with dex2oat warnings
body: <p>I have re-opened an Android Studio project after quite some time, and I'm seeing fast builds as usual, but now the "Install" step from Android Studio (3.5) is taking minutes, while it used to take seconds.</p>
  
  <p>If I open the device Logcat while installing, I can see a huge amount of these:</p>
  
  <pre><code>W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.onSaveInstanceState(android.os.Bundle)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.onViewCreated(android.view.View, android.os.Bundle)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.onViewModelCreated()
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.removeCancelListener(com.package.base.view.BaseDialog$CancelListener)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.removeDismissListener(com.package.base.view.BaseDialog$DismissListener)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.setChildFragmentInjector(dagger.android.DispatchingAndroidInjector)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.setSharedValue(java.lang.String, java.lang.Object)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseDialog.setViewModelFactory(androidx.lifecycle.ViewModelProvider$Factory)
  W/dex2oat: Method processed more than once: dagger.android.AndroidInjector com.package.base.view.BaseDialog.supportFragmentInjector()
  I/dex2oat: Explicit concurrent copying GC freed 647(112KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 60us total 250.774ms
  I/dex2oat: Explicit concurrent copying GC freed 446(29KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 60us total 252.704ms
  I/dex2oat: Explicit concurrent copying GC freed 396(13KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 67us total 257.367ms
  I/dex2oat: Explicit concurrent copying GC freed 413(13KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 68us total 258.540ms
  I/dex2oat: Explicit concurrent copying GC freed 413(13KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 64us total 253.988ms
  I/dex2oat: Explicit concurrent copying GC freed 413(13KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 61us total 258.701ms
  I/dex2oat: Explicit concurrent copying GC freed 413(13KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 60us total 255.313ms
  I/dex2oat: Explicit concurrent copying GC freed 419(45KB) AllocSpace objects, 0(0B) LOS objects, 32% free, 12MB/18MB, paused 60us total 261.034ms
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseFragment.&lt;init&gt;()
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseFragment.applyStatusBar(com.package.base.view.BaseFragment$StatusBar)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseFragment.dispatchOnStatusBar()
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseFragment.restoreStatusBar(android.app.Activity)
  W/dex2oat: Method processed more than once: void com.package.base.view.BaseFragment.saveStatusBar(android.app.Activity)
  </code></pre>
  
  <p>All methods seem to be processed twice (at least) and the garbage collector seems to be doing a lot of work.</p>
  
  <p>I don't know what happened, but I would love to have this fast as it was - right now developing is impossible. Can anyone help?</p>
  
  <h2>Extra info</h2>
  
  <p>Before dex2oat starts this very long process, I can see the following logs:</p>
  
  <pre><code>W/dex2oat: Unexpected CPU variant for X86 using defaults: x86
  W/dex2oat: Mismatch between dex2oat instruction set features (ISA: X86 Feature string: -ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) and those of dex2oat executable (ISA: X86 Feature string: ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) for the command line:
  W/dex2oat: /system/bin/dex2oat --zip-fd=8 --zip-location=base.apk --input-vdex-fd=-1 --output-vdex-fd=10 --oat-fd=9 --oat-location=/data/app/com.package-7KbZxh8JQyXUOcSGvv-5hA==/oat/x86/base.odex --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=quicken --swap-fd=11 --debuggable --classpath-dir=/data/app/com.package-7KbZxh8JQyXUOcSGvv-5hA== --class-loader-context=PCL[]
  I/dex2oat: /system/bin/dex2oat --input-vdex-fd=-1 --output-vdex-fd=10 --compiler-filter=quicken --debuggable --classpath-dir=/data/app/com.package-7KbZxh8JQyXUOcSGvv-5hA== --class-loader-context=PCL[]
  I/dex2oat: Large app, accepted running with swap.
  </code></pre>
  
  <h2>Build file</h2>
  
  <p>This is part of <code>build.gradle</code> for the app module. This is a multi-module project, but the other files are very similar.</p>
  
  <pre><code>android {
  
      compileSdkVersion(AndroidBuild.compileSdk)
  
      defaultConfig {
          applicationId = "com.package"
          minSdkVersion(AndroidBuild.minSdk)
          targetSdkVersion(AndroidBuild.targetSdk)
          versionCode = 7
          versionName = "0.2.0"
          vectorDrawables.useSupportLibrary = true
          renderscriptTargetApi = 24
          renderscriptSupportModeEnabled = true
          multiDexEnabled = true
  
          testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
          testInstrumentationRunnerArgument("clearPackageData", "true")
      }
  
      signingConfigs {
          create("release") {
              // signing stuff
          }
      }
  
      testOptions {
          // execution = "ANDROIDX_TEST_ORCHESTRATOR"
      }
  
      buildTypes {
          getByName("release") {
              signingConfig = signingConfigs.getByName("release")
              isShrinkResources = true
              isMinifyEnabled = true
              proguardFile(getDefaultProguardFile("proguard-defaults.txt"))
              proguardFile("proguard-rules.pro")
          }
          getByName("debug") {
              versionNameSuffix = "-debug"
              // Hoping that this should speed up builds due to multidexing
              defaultConfig.minSdkVersion(21)
          }
      }
  
      dataBinding.isEnabled = true
      compileOptions {
          sourceCompatibility = JavaVersion.VERSION_1_8
          targetCompatibility = JavaVersion.VERSION_1_8
      }
  }
  </code></pre>
  
  <h2>aapt output when using vmSafeMode="true"</h2>
  
  <p>Output when running <code>./Library/Android/sdk/build-tools/29.0.2/aapt list -a app-debug.apk</code> is huge, pasting only the relevant part:</p>
  
  <pre><code>E: application (line=57)
    A: android:theme(0x01010000)=@0x7f11014c
    A: android:label(0x01010001)=@0x7f100002
    A: android:icon(0x01010002)=@0x7f0e0001
    A: android:name(0x01010003)="com.package.App" (Raw: "com.package.App")
    A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
    A: android:allowBackup(0x01010280)=(type 0x12)0xffffffff
    A: android:vmSafeMode(0x010102b8)=(type 0x12)0xffffffff
    A: android:supportsRtl(0x010103af)=(type 0x12)0xffffffff
    A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
  </code></pre>