24小时前我的项目完美构建,没有错误.在不更改单个代码的情况下,当我恢复工作时,它将不再构建.
签出旧的工作提交现在会产生相同的错误.
这些是我得到的错误代码:
Information:Gradle tasks [assemble]
Error:(9,5) error: resource android:attr/dialogCornerRadius not found.
/home/liam/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0-alpha1.aar/536e4dd78846259cf8bef0fd6a3ea0e6/res/values/values.xml
我认为这是由Android P发布和我的Android Studio自动升级或类似的东西引起的.这可以解释为什么有效的旧提交会得到同样的错误.
这将是一个非常新的问题,这可以解释为什么我还没有找到解决方案.
搜索这些错误代码会导致类似的问题,可以通过更改gradle构建文件中的SDK版本来解决.我的问题与此不同,因为更改为SDK 28(我很确定28甚至不存在)导致android工作室说这个包不可用/不存在下载.
单击前面提到的错误代码会打开一个名为v28 / values-v28.xml的文件.
?android:attr/dialogCornerRadius
?android:attr/dialogCornerRadius
这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.timelord.timelord.timelord"
minSdkVersion 24
targetSdkVersion 26
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.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/joda-time-2.9.9.jar')
}
和
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}