【发布时间】:2019-11-17 17:58:38
【问题描述】:
我是 Android 编程新手。当我尝试将材料设计库添加到
build.gradle 它在实现“com.android.support:appcompat-v7:28.0.0”下显示错误。
错误信息是:
使用groupId
com.android.support和androidx.*的依赖不能合并但是发现IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='support-fragment', myVersion='28.0.0', myPacking='aar', myClassifier='null'}和IdeMavenCoordinates{myGroupId='androidx.arch.core', myArtifactId='core-runtime', myVersion='2.0.0', myPacking='aar', myClassifier='null'}不兼容的依赖少... (Ctrl+F1)
检查信息:有一些库或工具和库的组合不兼容,或者可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。问题 ID:GradleCompatible
我不想删除 appcompat,因为我想支持较低的版本。
这是我的 gradle 代码:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.vignesh.materialdesigntest"
minSdkVersion 21
targetSdkVersion 28
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.google.android.material:material:1.1.0-alpha07"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
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'
}
【问题讨论】:
-
迁移到androidx
标签: android android-studio material-design android-appcompat