android - 为 android studio 安装 Material Design 时出错
问题描述
在过去的几天里,我一直在熟悉 Android Studio,它在大多数情况下都很稳定,直到我添加了 Material Design 依赖项,并且在构建项目时遇到了一大堆错误。
我一直在修补 buildtools/sdk 版本,但似乎没有任何效果。
这是我的 build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.anuythe.com.apend"
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.android.support:appcompat-v7: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'
}
解决方案
我建议你升级到 AndroidX:
dependencies {
implementation
'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat.appcompat:1.1.0'
implementation
'androidx.constraintlayout.constraintlayout:1.1.3'
}
PS:虽然这些版本不是最新的,但只是为你指明了正确的方向。
干杯!
推荐阅读
- sql-server - SQL Server 舍入差异
- python - 错误:在 Python 中绘制热图 - 类型错误
- flopy - 如何在 FloPy Modflow6 中输出所有时间步的 MAW 头值?
- node.js - 有没有办法显示在 Node-cron 下安排的所有作业?
- unity3d - Unity中的图像动画问题
- git - 当我转到“Got to Files”时,我的 github 存储库中的某些文件未列出
- python - 如何使用下拉更新绘图标题?
- pdf - 有什么方法可以在 Firefox 中显示内嵌 PDF?
- node.js - 开玩笑的模拟给出了未定义的
- php - 自定义帖子类型的 WordPress 永久链接结构