【问题标题】:Uncaught translation error: com.android.dx.cf.code.SimException: local 0007: invalid未捕获的翻译错误:com.android.dx.cf.code.SimException:本地 0007:无效
【发布时间】:2023-04-03 15:33:01
【问题描述】:

我没有使用 Proguard。 项目正在成功构建,但是当我尝试在设备上运行时,它显示此错误。我在 Android Studio 3.0 中使用 Kotlin 项目工作,体验非常糟糕。我决定切换回 2.3 AS,但问题还是一样。日志更小,但异常文本相同。

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'

【问题讨论】:

    标签: android gradle kotlin


    【解决方案1】:

    Google 问题跟踪器中的类似 issue

    尝试在 Android Studio 中禁用 Instant Run

    禁用即时运行:

    1. 打开“设置”或“首选项”对话框。

    2. 导航至构建、执行、部署 > 即时运行。

    3. 取消选中启用即时运行旁边的框。

    【讨论】:

    • 这确实有意义 - Instant Run 使用 Partial Dex,如果您跟踪堆栈跟踪比 OP 中发布的更远一点,您会看到该风味存在 dex 失败。
    猜你喜欢
    • 1970-01-01
    • 2016-11-20
    • 2016-02-22
    • 2016-02-08
    • 1970-01-01
    • 2020-03-28
    • 1970-01-01
    • 2019-06-09
    • 2018-04-09
    相关资源
    最近更新 更多