请问安全参数缺少什么依赖项或发生冲突
我正在学习一些 kotlin 概念。我还不太明白。
我将 SafeArgs 类路径和插件添加到相应的 build.gradle 文件中。
这是类路径:
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
这是插件
id 'androidx.navigation.safeargs.kotlin'
即使在此之后我仍然收到缺少或冲突的依赖项错误
Cannot access class 'com.example.testingtaskmanager.ui.updatefragment.UpdateFragmentArgs'. Check your module classpath for missing or conflicting dependencies
我现在明白 SafeArgs
需要与其他依赖项处于一致的版本,但我并不是真的与此类似。
所以,我将链接我的所有 build.gradle 文件(包括应用程序和项目级别),以便您可以查看它(如果要求不是太多的话)。提前致谢。
build.gradle应用程序级别;
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
//
// id "androidx.navigation.safeargs"
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-parcelize'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.testingbottomnav"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
viewBinding true
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.0"
//Material Components
implementation 'com.google.android.material:material:1.4.0'
// Navigation Component
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
// Added for To-Do List
// Dependencies for working with Architecture components
// You'll probably have to update the version numbers in build.gradle (Project)
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.31"
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// Room components
implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
implementation "androidx.room:room-ktx:2.2.6"
androidTestImplementation "androidx.room:room-testing:2.2.6"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0"
// Kotlin components
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
// DataBinding
kapt "com.android.databinding:compiler:3.2.0-alpha10"
kapt "androidx.databinding:databinding-common:4.1.2"
// RecyclerView Animator
implementation 'jp.wasabeef:recyclerview-animators:3.0.0'
}
build.gradle项目级别;
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
appcompat_version = "1.2.0"
constraintlayout_version = "2.0.2"
core_ktx_version = "1.3.2"
kotlin_version = "1.3.72"
material_version = "1.2.1"
nav_version = "2.3.1"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
//
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我真的很感谢任何帮助,提前非常感谢。如果您需要任何信息,我非常乐意提供。
再次感谢。
I am learning some kotlin concepts. I don't really understand yet.
I added SafeArgs
classpath and plugin to the appropriate build.gradle file.
Here's the classpath:
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
And Here's the plugin
id 'androidx.navigation.safeargs.kotlin'
Even After this I still get an missing or conflicting dependencies error
Cannot access class 'com.example.testingtaskmanager.ui.updatefragment.UpdateFragmentArgs'. Check your module classpath for missing or conflicting dependencies
I now understand that the SafeArgs
needs to be in a consistent version with some other dependiency, but I am not really similar with this.
Here's a picture of the error for clarify sake;
So please I am going to link all my build.gradle file both app and project level, so you can take a look at it, if it's not too much to ask.. Thanks in Advance.
build.gradle app level;
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
//
// id "androidx.navigation.safeargs"
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-parcelize'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.testingbottomnav"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
viewBinding true
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.0"
//Material Components
implementation 'com.google.android.material:material:1.4.0'
// Navigation Component
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
// Added for To-Do List
// Dependencies for working with Architecture components
// You'll probably have to update the version numbers in build.gradle (Project)
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.31"
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// Room components
implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
implementation "androidx.room:room-ktx:2.2.6"
androidTestImplementation "androidx.room:room-testing:2.2.6"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0"
// Kotlin components
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
// DataBinding
kapt "com.android.databinding:compiler:3.2.0-alpha10"
kapt "androidx.databinding:databinding-common:4.1.2"
// RecyclerView Animator
implementation 'jp.wasabeef:recyclerview-animators:3.0.0'
}
build.gradle project level;
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
appcompat_version = "1.2.0"
constraintlayout_version = "2.0.2"
core_ktx_version = "1.3.2"
kotlin_version = "1.3.72"
material_version = "1.2.1"
nav_version = "2.3.1"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
//
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'd really apppreciate any help, Thanks so much in advance. If you need any information I am more than happ to provide.
Thanks again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否尝试过使用与导航相同的插件版本,现在您有用于 safeargs 的 2.3.1 和用于基本导航依赖项的 2.3.5。
Have you tried using the same version for the plugin as you use for navigation right now you have 2.3.1 for safeargs and 2.3.5 for base navigation dependency.
您的
gradle.properties
文件中必须有android.useAndroidX=true
版本 2.3.1 的依赖项更改
检查以下内容 页面 以及 github
You must have
android.useAndroidX=true
in yourgradle.properties
fileDependency Changes for version 2.3.1
Check the following page and the related samples on github
将 gradle 的插件版本升级到 8.2.0 后,我开始遇到这个问题。
为了解决这个问题,我从
到
即,我刚刚将版本从2.3.0升级到2.5.2。
I started having this issue after upgrading the gradle's plugin version to 8.2.0.
In order to solve this issue, i went from
to
That is, I just upgraded the version from 2.3.0 to 2.5.2.