Material Android 不支持设计和 Appcompat-v7?
Material design and Appcompat-v7 not supported in Android?
我是 Android 编程新手。当我尝试将 material 设计库添加到
build.gradle 显示执行错误 'com.android.support:appcompat-v7:28.0.0'。
错误信息是:
Dependencies using groupId com.android.support
and androidx.*
can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='support-fragment', myVersion='28.0.0', myPacking='aar', myClassifier='null'}
and IdeMavenCoordinates{myGroupId='androidx.arch.core', myArtifactId='core-runtime', myVersion='2.0.0', myPacking='aar', myClassifier='null'}
incompatible dependencies less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion). Issue 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 工作室菜单
Refactor
在此菜单下
转到
Migrate to AndroidX
更多信息AndroidX
希望对您有所帮助!
在 Android Studio 中,导航到 Refactor
菜单和 select 迁移到 AndroidX
我是 Android 编程新手。当我尝试将 material 设计库添加到
build.gradle 显示执行错误 'com.android.support:appcompat-v7:28.0.0'。
错误信息是:
Dependencies using groupId
com.android.support
andandroidx.*
can not be combined but foundIdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='support-fragment', myVersion='28.0.0', myPacking='aar', myClassifier='null'}
andIdeMavenCoordinates{myGroupId='androidx.arch.core', myArtifactId='core-runtime', myVersion='2.0.0', myPacking='aar', myClassifier='null'}
incompatible dependencies less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion). Issue 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 工作室菜单
Refactor
在此菜单下 转到
Migrate to AndroidX
更多信息AndroidX
希望对您有所帮助!
在 Android Studio 中,导航到 Refactor
菜单和 select 迁移到 AndroidX