NoClassDefFoundError: android.arch.persistence.room.RoomDatabase $ MigrationContainer - PullRequest
0 голосов
/ 06 ноября 2018

У меня есть проект с управлением Room Daatbase. Но у меня была следующая ошибка времени выполнения при выполнении приложения в моем мобильном телефоне с Android 4.4.2:

java.lang.NoClassDefFoundError: android.arch.persistence.room.RoomDatabase$MigrationContainer
                                                                                at android.arch.persistence.room.RoomDatabase$Builder.<init>(RoomDatabase.java:332)
                                                                                at android.arch.persistence.room.Room.databaseBuilder(Room.java:55)
                                                                                at com.jangapp.red.consumidores.App.onCreate(App.java:72)
                                                                                at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1009)
                                                                                at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
                                                                                at android.app.ActivityThread.access$1800(ActivityThread.java:141)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:136)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5342)
                                                                                at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
                                                                                at dalvik.system.NativeStart.main(Native Method)

Вот моя конфигурация graddle

apply plugin: 'com.android.application'
apply plugin: 'com.apollographql.android'

android {
    compileSdkVersion 27
    buildToolsVersion "26.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "..."
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.3"
        multiDexEnabled true

    }
    buildTypes {
        debug {
            minifyEnabled false
            useProguard false
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.android.support:appcompat-v7:27.0.1'
    compile 'com.android.support:design:27.0.1'
    compile 'com.android.support:cardview-v7:27.0.1'
    compile 'com.android.support:support-v4:27.0.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.google.android.gms:play-services-location:11.0.4'
    compile 'com.google.android.gms:play-services-places:11.0.4'
    compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
    compile 'com.apollographql.apollo:apollo-runtime:0.5.0'
    compile 'com.apollographql.apollo:apollo-android-support:0.5.0'
    compile 'com.apollographql.apollo:apollo-rx2-support:0.5.0'
    compile 'com.apollographql.apollo:apollo-http-cache:0.5.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.0'
    compile 'com.orhanobut:hawk:2.0.1'
    compile 'com.github.reinaldoarrosi:maskededittext:1.1.0'
    implementation 'com.github.MAXDeliveryNG:slideview:1.1.0'
    compile 'com.github.TR4Android:Swipeable-RecyclerView:0.2.0'
    compile 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2'
    compile 'android.arch.persistence.room:runtime:1.0.0'
    annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
    compile 'com.valdesekamdem.library:md-toast:0.9.0'
    compile 'me.leolin:ShortcutBadger:1.1.21@aar'
    compile 'com.github.minibugdev:drawablebadge:1.0.3'
    compile 'com.android.support:multidex:1.0.3'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile 'com.fxn769:pix:1.0.5'
    compile 'id.zelory:compressor:2.1.0'
}

и

buildscript {
    repositories {
        //google()
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.apollographql.apollo:apollo-gradle-plugin:0.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
        maven { url 'https://jitpack.io' }

    }

}

Я много раз пытался найти решение, но похоже, Ни у кого не было этой ошибки.

Как я могу исправить эту ошибку во время выполнения?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...