我想使用 android jetpack 的新导航库。当我想向我的项目添加导航 XML 时,我收到一条错误消息:
此操作需要库 android.arch.navigation:navigation-fragment:+、android.arch.navigation:navigation-ui:+。
问题:发现现有项目依赖项中的不一致。版本不兼容: - android.arch.persistence.room:runtime:1.1.1 和: - com.android.support:appcompat-v7:27.1.1
具有依赖关系:- com.android.support:support-annotations:26.1.0 与:- com.android.support:support-annotations:27.1.1
添加这些库后,项目可能无法编译。还是要添加它们?
我点击“取消”,因为我不知道我的小项目会产生什么后果。为什么会这样?房间与导航库不兼容?添加这些后我的项目是否会面临无法编译的风险?我应该保存 gradle 文件并尝试一下吗?
我将非常感谢您的澄清。谢谢:)
我的毕业文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "de.test"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
}