Uncaught translation error: com.android.dx.cf.code.SimException: local 0007: invalid

匿名 (未验证) 提交于 2019-12-03 09:05:37

问题:

I don't use Proguard. The project is building successfully but when I try to run on the device it shows this error. I was working in Android Studio 3.0 with a Kotlin project and it was really bad experience. I decided to switch back to 2.3 AS but the problem is still the same. The log is smaller but the exception text is the same.

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-android-extensions'  tasks.withType(JavaCompile) {     options.fork = true     options.incremental = true }  android {     def rootProject = rootProject.ext      compileSdkVersion rootProject.compileSdkVersion     buildToolsVersion rootProject.buildToolsVersion     defaultConfig {         minSdkVersion rootProject.minSdkVersion         targetSdkVersion rootProject.targetSdkVersion         versionCode rootProject.versionCode         versionName rootProject.versionName         testInstrumentationRunner rootProject.testInstrumentationRunner         vectorDrawables.useSupportLibrary = true        // multiDexEnabled true     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }         debug {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     }     productFlavors {         //flavorDimensions "content"         production {           //  dimension "content"         }         staging {             //dimension "content"         }     }      // Remove productionDebug and stagingRelease as it's not needed.     android.variantFilter { variant ->         if (variant.buildType.name == 'release'                 && variant.getFlavors().get(0).name == 'staging') {             variant.setIgnore(true)         } else if (variant.buildType.name == 'debug' && variant.getFlavors().get(0).name == 'production') {             variant.setIgnore(true)         }     }      packagingOptions {         exclude 'META-INF/LICENSE.txt'         exclude 'META-INF/NOTICE.txt'     } } // Required for annotation processing plugins like Dagger kapt {     generateStubs = true }   dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])      compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"     compile 'com.android.support:appcompat-v7:26.0.0-beta2'     compile 'com.android.support:design:26.0.0-beta2'     compile 'com.android.support.constraint:constraint-layout:1.0.2'      //firebase     compile "com.google.firebase:firebase-auth:$firebaseVersion"     compile "com.google.firebase:firebase-database:$firebaseVersion"     compile "com.google.firebase:firebase-core:$firebaseVersion"     compile "com.google.firebase:firebase-storage:$firebaseVersion"      //rx     compile "io.reactivex.rxjava2:rxjava:$rxVersion"     compile "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"      //mvp     compile "com.hannesdorfmann.mosby3:mvp:$mosbyVersion"     compile 'com.hannesdorfmann.mosby3:mvp-conductor:3.0.0'      //dagger     compile "com.google.dagger:dagger:$daggerVersion"     kapt "com.google.dagger:dagger-compiler:$daggerVersion"      //image loader     compile 'com.github.bumptech.glide:glide:4.0.0-RC1'     kapt 'com.github.bumptech.glide:compiler:4.0.0-RC1'      //to work with dates     compile 'net.danlew:android.joda:2.9.9'      //bottom-bar     compile 'com.aurelhubert:ahbottomnavigation:2.0.6'     compile 'com.bluelinelabs:conductor:2.1.4'      //leak canary     debugCompile "com.squareup.leakcanary:leakcanary-android:$leakcanaryVersion"     releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanaryVersion"    // testcompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanaryVersion" }  apply plugin: 'com.google.gms.google-services' 

回答1:

Similar issue in google issue tracker.

Try to disable Instant Run in Android Studio

To disable Instant Run:

  1. Open the Settings or Preferences dialog.

  2. Navigate to Build, Execution, Deployment > Instant Run.

  3. Uncheck the box next to Enable Instant Run.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!