今天,我将项目从API 27更新为API28。在更新之前,我没有遇到任何错误。更改compileSdkVersion和buildVersion后,构建gradle时出现以下错误。我使用Kotlin作为该项目的主要编程语言。这是错误:
Execution failed for task ':app:processReleaseResources'.
> Android resource linking failed
Output: /Users/sagarsuri/Downloads/MyProject/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:2778: error: resource style/Widget.Design.CoordinatorLayout (aka com.sagar.myproject:style/Widget.Design.CoordinatorLayout) not found.
/Users/sagarsuri/Downloads/MyProject/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:4480: error: resource style/Widget.Design.CoordinatorLayout (aka com.sagar.myproject:style/Widget.Design.CoordinatorLayout) not found.
error: failed linking references.
这是我的应用模块build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.objectbox'
androidExtensions {
experimental = true
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.sagar.myproject"
minSdkVersion 21
targetSdkVersion 27
// Enabling multidex support.
multiDexEnabled true
versionCode 11
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.2'
}
ext {
supportLibraryVersion = '28.0.0'
glideLibraryVersion = '4.6.1'
retrofitLibraryVersion = '2.4.0'
rxJavaVersion = '2.1.0'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:support-v4:$supportLibraryVersion"
implementation "com.android.support:support-v13:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
//Glide library
implementation "com.github.bumptech.glide:glide:$glideLibraryVersion"
kapt "com.github.bumptech.glide:compiler:$glideLibraryVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
//Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitLibraryVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitLibraryVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitLibraryVersion"
//RxJava
implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"
//ObjectBox
implementation "io.objectbox:objectbox-android:$objectboxVersion"
implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
kapt "io.objectbox:objectbox-processor:$objectboxVersion"
//MaterialDialog
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
//ReactiveNetwork
implementation 'com.github.pwittchen:reactivenetwork-rx2:0.12.3'
//MultiDex
implementation 'com.android.support:multidex:1.0.3'
//Fotoapparat
implementation 'io.fotoapparat.fotoapparat:library:2.2.0'
//ChartView
implementation 'com.github.razerdp:AnimatedPieView:1.2.4'
implementation 'com.leinardi.android:speed-dial:2.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'me.shaohui.advancedluban:library:1.3.5'
implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.0.5'
testImplementation 'junit:junit:4.12'
// implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
请让我知道导致错误的原因。 Android Studio的版本为3.2
答案 0 :(得分:5)
您尝试过this answer on SO吗?它帮助了我。我有多模块项目。您需要替换
style / Widget.Design.CoordinatorLayout
使用
@ style / Widget.Support.CoordinatorLayout
在所有styles.xml文件中。当我尝试在AndroidX上迁移(不仅更新为API 28)时,发生了这个问题