如何解决错误“ encoded_value方法类型大小为7的错误”

时间:2019-12-26 14:36:41

标签: java android

 java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[...]

Suppressed: java.io.IOException: Failed to open dex files from /....==/base.apk because: Bad encoded_array value: Failure to verify dex file '.....==/base.apk': Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.abstractnewsdigest-gHpWdk3tBZsBeX9bz-UJ-w==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.abstractnewsdigest-gHpWdk3tBZsBeX9bz-UJ-w==/base.apk': Bad encoded_value method type size 7

项目build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.50'

    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath "io.realm:realm-gradle-plugin:5.13.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.1.0'
    }

}

allprojects {
    repositories {
        jcenter()
        google()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用程序build.gradle:

apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"
apply plugin: "realm-android"
android {
    compileSdkVersion 29
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId 'com.abstractnewsdigest'
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 13
        versionName "13"
        multiDexEnabled true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        debug {
            //Properties stored in ~/.gradle/gradle.properties
           debuggable true
        }
        release {            
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    dataBinding.enabled = true
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
    productFlavors {
    }
}

repositories {
    google()
    maven { url "https://maven.google.com" }
    maven { url "https://jitpack.io" }
}
dependencies {

    // Place to find the latest available version of support libraries hosted by Google

    // https://dl.google.com/dl/android/maven2/index.html
    def androidSupportVersion = "28.0.0"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-firestore:17.1.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.firebaseui:firebase-ui-database:4.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android:flexbox:1.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    //    kapt "com.android.databinding:compiler:3.1.3"
    implementation 'com.github.pardom:redux-kotlin:1.2.1'

    // Litho
    def lithoVersion = "0.18.0"
    implementation "com.facebook.litho:litho-core:$lithoVersion"
    implementation "com.facebook.litho:litho-widget:$lithoVersion"
    compileOnly "com.facebook.litho:litho-annotations:$lithoVersion"
    kapt "com.facebook.litho:litho-annotations:$lithoVersion"
    kapt "com.facebook.litho:litho-processor:$lithoVersion"

    // SoLoader
    implementation 'com.facebook.soloader:soloader:0.5.1'

    // For integration with Fresco
    implementation 'com.facebook.fresco:fresco:1.10.0'
    implementation "com.facebook.litho:litho-fresco:$lithoVersion"

    // For testing
    testImplementation "com.facebook.litho:litho-testing:$lithoVersion"

    // Sections
    implementation "com.facebook.litho:litho-sections-core:$lithoVersion"
    implementation "com.facebook.litho:litho-sections-widget:$lithoVersion"
    compileOnly "com.facebook.litho:litho-sections-annotations:$lithoVersion"
    kapt "com.facebook.litho:litho-sections-annotations:$lithoVersion"
    kapt "com.facebook.litho:litho-sections-processor:$lithoVersion"
    def lifecycle_version = "1.1.1"

    // ViewModel and LiveData
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'
    implementation 'com.android.billingclient:billing:1.1'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    def work_version = "1.0.0-alpha10"
    implementation ('androidx.work:work-runtime-ktx:2.0.1') {
        exclude group: 'com.google.guava', module: 'listenablefuture'
        exclude group: 'androidx.work'
    }

    // use -ktx for Kotlin
    implementation ("android.arch.work:work-firebase:$work_version") {
        exclude group: 'com.google.guava', module: 'listenablefuture'
    }

    implementation 'io.branch.sdk.android:library:2.+'
    implementation 'joda-time:joda-time:2.10'
//    implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
    implementation 'com.google.gms:google-services:4.3.3'
}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:2)

会很晚,但也许有人需要知道。 您应该添加compileOptions { targetCompatibility JavaVersion.VERSION_1_8 } 在您的android部分下的build:gradle(:app)中。然后进行同步。它对我有用!