错误:无法解决:androidx.room:房间运行时:1.0.0

时间:2019-07-16 09:48:29

标签: android rest mvvm android-room android-architecture-components

我正在学习android mvvm教程,但是我从gradle获取了以下错误消息

错误:无法解决:androidx.room:房间运行时:1.0.0 在项目结构对话框中显示 受影响的模块:应用

错误:无法解决:org.kodein.di:kodein-di-generic-jvm:1.0.0 在项目结构对话框中显示 受影响的模块:应用

错误:无法解决:org.kodein.di:kodein-di-framework-android-x:1.0.0 在项目结构对话框中显示 受影响的模块:应用

在我的app.gradle下面

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: "kotlin-kapt"

apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.forecastmvvm"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.0.0"
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation "android.arch.navigation:navigation-fragment:1.0.0"
    implementation "android.arch.navigation:navigation-ui:1.0.0"
    implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
    implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"

    implementation "androidx.core:core-ktx:1.0.0"
    implementation "androidx.constraintlayout:constraintlayout:1.1.3"

    // Room
    implementation "androidx.room:room-runtime:1.0.0"
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0'
    kapt "androidx.room:room-compiler:1.0.0"

    // Gson
    implementation "com.google.code.gson:gson:2.8.5"

    // Kotlin Android Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0"

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:2.0.0"
    implementation "com.squareup.retrofit2:converter-gson:2.0.0"
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

    // ViewModel
    implementation "androidx.lifecycle:lifecycle-extensions:1.0.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:1.0.0"
    kapt "androidx.lifecycle:lifecycle-compiler:1.0.0"

    // Kodein
    implementation "org.kodein.di:kodein-di-generic-jvm:1.0.0"
    implementation "org.kodein.di:kodein-di-framework-android-x:1.0.0"

    // Better dateTime-time support even on older Android versions
    implementation "com.jakewharton.threetenabp:threetenabp:1.1.0"

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    kapt 'com.github.bumptech.glide:compiler:4.8.0'

    // Groupie RecyclerView
    implementation 'com.xwray:groupie:2.1.0'
    implementation 'com.xwray:groupie-kotlin-android-extensions:2.1.0'

    // Preference
    implementation "androidx.preference:preference:1.0.0"

    // WeatherLocation
    implementation "com.google.android.gms:play-services-location:16.0.0"

    // New Material Design
    implementation "com.google.android.material:material:1.0.0"

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

低于gradle

buildscript {
    ext.kotlin_version = '1.3.41'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

1 个答案:

答案 0 :(得分:0)

修改

androidx.room:room-runtime:1.0.0
org.kodein.di:kodein-di-generic-jvm:1.0.0
org.kodein.di:kodein-di-framework-android-x:1.0.0

androidx.room:room-runtime:2.1.0
org.kodein.di:kodein-di-generic-jvm:6.3.3
org.kodein.di:kodein-di-framework-android-x:6.3.3

此外,检查其他依赖项,您可能输入了错误的版本,或者输入的不是最新版本。