添加具有此错误的依赖项后,谁知道如何解决?

时间:2019-09-10 08:12:38

标签: android kotlin

我正在尝试基于MVVM创建一个新项目,并添加了所需的所有依赖项。 到目前为止,这是我添加并完成的操作:

  1. 在gradle文件中添加了依赖项
  2. 添加了插件
  3. 启用dataBinding为true
  4. 在gradle文件中添加了类路径 类路径“ androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-alpha05”
  5. 添加了android.databinding.enableV2 = true 在gradle.properties内部

我正在关注此youtube播放列表中的指南:

https://www.youtube.com/watch?v=Rd5dLmKewqg&list=PLk7v1Z2rk4hjVaZ8DZKe8iT9RIM9OUrwp&index=2

到目前为止我尝试过的东西:

  1. 我已经检查过 android.useAndroidX = true和android.enableJetifier = true

  2. 替换为gradle文件中的minifyEnable false

该应用程序甚至无法编译并且一直显示错误

这是我的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 {
    google()
    jcenter()

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

    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-alpha05"
}
    }

    allprojects {
repositories {
    google()
    jcenter()

}
    }

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

这是我的gradle Module:app文件:

    apply plugin: 'com.android.application'

    apply plugin: 'kotlin-android'

    apply plugin: 'kotlin-android-extensions'

    //kotlin kapt and navigation safeargs plugin
    apply plugin: 'kotlin-kapt'

    apply plugin: "androidx.navigation.safeargs"

    android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.mvvmsampleapp"
    minSdkVersion 22
    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'
    }

}

dataBinding {
    enabled = true
}
    [This is the error][1]}

    dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

//Retrofit and GSON
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'

//Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1"

// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"

//New Material Design
implementation 'com.google.android.material:material:1.1.0-alpha07'

//Kodein Dependency Injection
implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1"
implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1"

//Android Room
implementation "androidx.room:room-runtime:2.1.0-rc01"
implementation "androidx.room:room-ktx:2.1.0-rc01"
kapt "androidx.room:room-compiler:2.1.0-rc01"

//Android Navigation Architecture
implementation "androidx.navigation:navigation-fragment-ktx:2.1.0-alpha05"
implementation "androidx.navigation:navigation-ui-ktx:2.1.0-alpha05"

implementation 'com.xwray:groupie:2.3.0'
implementation 'com.xwray:groupie-kotlin-android-extensions:2.3.0'
implementation 'com.xwray:groupie-databinding:2.3.0'

    }

这是我的错误消息

    /Users/garylim/Downloads/MVVMSampleApp/app/build/generated/source/kapt/debug/com/example/mvvmsampleapp/DataBinderMapperImpl.java:9: error: cannot find symbol
    import com.example.mvvmsampleapp.databinding.ActivityLoginBindingImpl;
                                        ^
      symbol:   class ActivityLoginBindingImpl
      location: package com.example.mvvmsampleapp.databinding 

P.S。无法发布图片

0 个答案:

没有答案