link 资源缺失错误将 androidx 首选项从 1.0.0 更新到 1.1.0
link resources missing errors updating androidx preference from 1.0.0 to 1.1.0
我们的 android 项目在不久前移植到 androidx 后工作正常。
现在我尝试将 androidx.preference.preference 从 1.0.0 升级到 1.1.0 - 这是我所做的唯一更改 - 我得到了这些缺少资源的错误:
> What went wrong:
Execution failed for task ':mobile:processGoogleYokeeDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:67: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource dimen/preference_seekbar_padding_end (aka com.mystuff.myapp:dimen/preference_seekbar_padding_end) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource dimen/preference_seekbar_value_width (aka com.mystuff.myapp:dimen/preference_seekbar_value_width) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:62: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource dimen/preference_seekbar_padding_end (aka com.mystuff.myapp:dimen/preference_seekbar_padding_end) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource dimen/preference_seekbar_value_width (aka com.mystuff.myapp:dimen/preference_seekbar_value_width) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
这是我的 build.gradle:
的精简副本
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.1'
}
}
plugins {
id "ca.coglinc.javacc" version "2.4.0"
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.github.ben-manes.versions'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://adcolony.bintray.com/AdColony' }
flatDir { dirs 'libs' }
}
greendao {
schemaVersion 10
}
configurations.all {
resolutionStrategy {
force "com.android.support:cardview-v7:$supportLibraryVersion",
"com.android.support:customtabs:$supportLibraryVersion",
"com.android.support:mediarouter-v7:$supportLibraryVersion"
}
}
android {
compileSdkVersion global_compileSdkVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_compileSdkVersion
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
signingConfigs {
debug {
...
}
release {
...
}
}
flavorDimensions "store", "brand"
productFlavors {
all {
ext.flavor = null
}
google {
...
}
amazon {
...
}
app1 {
dimension "brand"
signingConfig signingConfigs.release
}
app2 {
dimension "brand"
signingConfig signingConfigs.release
}
}
compileJavacc {
inputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
}
compileJjtree {
inputDirectory = file('javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
}
sourceSets {
test {
java.srcDir file('tests')
}
androidTest {
java.srcDir file('androidTest')
}
main {
manifest.srcFile 'AndroidManifest.xml'
assets.srcDirs = ['assets']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
java.srcDirs = ['src', 'build/generated/javacc']
}
google {
manifest.srcFile 'flavors/google/AndroidManifest.xml'
aidl.srcDirs = ['flavors/google/src']
}
googleApp1 {
java.srcDirs = ['flavors/google/src', 'flavors/googleApp1/src']
res.srcDirs = ['flavors/google/res', 'flavors/googleApp1/res']
assets.srcDirs = ['assets', 'flavors/app1/assets', 'flavors/googleApp1/assets']
}
googleApp2 {
java.srcDirs = ['flavors/google/src', 'flavors/googleApp2/src']
res.srcDirs = ['flavors/google/res', 'flavors/googleApp2/res']
assets.srcDirs = ['assets', 'flavors/app2/assets', 'flavors/googleApp2/assets']
}
amazon {
manifest.srcFile 'flavors/amazon/AndroidManifest.xml'
}
amazonApp1 {
...
}
amazonApp2 {
...
}
app1 {
manifest.srcFile 'flavors/app1/AndroidManifest.xml'
res.srcDirs = ['flavors/app1/res']
java.srcDirs = ['flavors/app1/src']
}
app2 {
manifest.srcFile 'flavors/app2/AndroidManifest.xml'
res.srcDirs = ['flavors/app2/res']
java.srcDirs = ['flavors/app2/src']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
crashlytics {
...
}
}
debug {
ext.enableCrashlytics = false
minifyEnabled false
...
}
}
dexOptions {
javaMaxHeapSize "3g"
}
lintOptions {
abortOnError false
}
externalNativeBuild {
ndkBuild {
path "../jni/Android.mk"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
amazonImplementation fileTree(dir: 'flavors/amazon/libs', include: '*.jar')
googleImplementation fileTree(dir: 'flavors/google/libs', include: '*.jar')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.google.firebase:firebase-core:17.2.1"
implementation "com.google.firebase:firebase-ads:18.3.0"
implementation "com.google.firebase:firebase-messaging:20.0.0"
implementation "com.google.firebase:firebase-analytics:17.2.1"
implementation "com.google.android.gms:play-services-ads:18.3.0"
implementation "com.google.android.gms:play-services-analytics:17.0.0"
implementation "com.google.android.gms:play-services-auth:17.0.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0"
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'com.google.android.libraries.cast.companionlibrary:ccl:2.9.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.facebook.android:facebook-login:5.0.2'
implementation('com.facebook.android:audience-network-sdk:5.5.0') {
exclude module: 'exoplayer-core'
exclude module: 'exoplayer-dash'
}
api 'com.google.guava:guava:27.0.1-android' // when updating use the -android version
// Ads
implementation('com.vungle:publisher-sdk-android:6.3.24@aar') {
transitive=true
}
implementation 'com.google.ads.mediation:vungle:6.3.24.0'
implementation 'com.applovin:applovin-sdk:8.1.4'
implementation 'com.adcolony:sdk:3.3.5'
implementation 'com.unity3d.ads:unity-ads:3.0.0'
implementation 'com.google.ads.mediation:facebook:5.1.0.0'
implementation 'com.google.ads.mediation:chartboost:7.3.0.0'
implementation 'com.google.ads.mediation:applovin:8.1.4.0'
implementation 'com.google.ads.mediation:adcolony:3.3.5.1'
implementation 'com.google.ads.mediation:unity:3.0.0.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
// Etc.
implementation 'com.googlecode.mp4parser:isoparser:1.1.22'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'androidx.multidex:multidex:2.0.0' // check on low API before updating
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { transitive = true; }
implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.1.0@aar') { transitive = true }
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'com.parse.bolts:bolts-android:1.4.0'
implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.21.0'
implementation 'com.amazonaws:aws-android-sdk-core:2.9.1'
implementation 'com.amazonaws:aws-android-sdk-s3:2.9.1'
implementation 'com.github.anrwatchdog:anrwatchdog:1.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0' // support kotlin before updating
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
implementation ('eu.livotov.labs.android:CAMView:2.0.2@aar') { transitive = true }
implementation 'pub.devrel:easypermissions:3.0.0'
implementation 'com.rockerhieu:rv-adapter-endless:1.2'
googleImplementation 'com.google.android.exoplayer:exoplayer:2.8.2'
amazonImplementation 'com.amazon.android:exoplayer:2.8.2'
implementation('com.google.android.exoplayer:extension-okhttp:2.8.2') { transitive = false }
implementation 'com.airbnb.android:lottie:2.5.6'
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.github.florent37:viewanimator:1.0.5'
implementation 'com.github.lamydev:android-notification:3.0'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation 'com.appsflyer:af-android-sdk:4.9.0'
implementation 'com.android.installreferrer:installreferrer:1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'org.powermock:powermock-mockito-release-full:1.6.4'
testImplementation 'org.json:json:20140107'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
注意我有多层次的口味。我已将详细信息修改为 app1 和 app2。
检查这些文件是否存在格式错误XML。查看导致此错误的各种问题
这个 build.gradle
不完全是 MVCE, but quite cluttered, which does not help much with reproducing the issue. And that should rather be androidx.lifecycle
。虽然您应该摆脱 resolutionStrategy
force
并正确修复此问题,但 最终 与相应包上的 exclude group: "com.android.support"
,因为它可能会干扰。尝试 运行ning ./gradlew app:dependencies > dependencies.txt
(或任何模块名称)以获得更多见解。我怀疑这个包裹(无论它打算修复什么):
implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0"
As it seems,没有 androidx.legacy:legacy-preference-v14
的版本 1.1.0
,因此保留 androidx.preference:preference:1.0.0
。 build.gradle
甚至没有任何版本 1.1.0
,这使得问题更难重现。其中一个长 运行,将 dependencies
分为当前的和仍在使用 com.android.support
的
可能是有意义的
如果您可以提供一个 最小 示例(可以简单地复制并粘贴到 build.gradle
并让它崩溃),那么我可能会提供一个更准确的答案。
可能的解决方案:
使缓存无效并重新启动 Android Studio。
此外,我在构建发布版 APK 时遇到了同样的问题
从修改构建脚本后解析的构建管道
./gradlew assembleRelease 到 ./gradlew app:assembleRelease
检查 official doc for changes,有几个重要的 changes/improvements 可能会影响。
改变
implementation 'com.takisoft.fix:preference-v7:28.0.0.0'
到
implementation 'com.takisoft.preferencex:preferencex:1.1.0'
我们的 android 项目在不久前移植到 androidx 后工作正常。
现在我尝试将 androidx.preference.preference 从 1.0.0 升级到 1.1.0 - 这是我所做的唯一更改 - 我得到了这些缺少资源的错误:
> What went wrong:
Execution failed for task ':mobile:processGoogleYokeeDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:67: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource dimen/preference_seekbar_padding_end (aka com.mystuff.myapp:dimen/preference_seekbar_padding_end) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource dimen/preference_seekbar_value_width (aka com.mystuff.myapp:dimen/preference_seekbar_value_width) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v17/preference_widget_seekbar_material.xml:116: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:62: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource dimen/preference_seekbar_padding_end (aka com.mystuff.myapp:dimen/preference_seekbar_padding_end) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource dimen/preference_seekbar_value_width (aka com.mystuff.myapp:dimen/preference_seekbar_value_width) not found.
/Users/myuser/.gradle/caches/transforms-2/files-2.1/e940732939c565e523da3f48e9072bde/jetified-preference-v7-28.0.0.0/res/layout-v21/preference_widget_seekbar_material.xml:107: AAPT: error: resource style/Preference_TextAppearanceMaterialSubhead (aka com.mystuff.myapp:style/Preference_TextAppearanceMaterialSubhead) not found.
这是我的 build.gradle:
的精简副本buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.1'
}
}
plugins {
id "ca.coglinc.javacc" version "2.4.0"
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.github.ben-manes.versions'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://adcolony.bintray.com/AdColony' }
flatDir { dirs 'libs' }
}
greendao {
schemaVersion 10
}
configurations.all {
resolutionStrategy {
force "com.android.support:cardview-v7:$supportLibraryVersion",
"com.android.support:customtabs:$supportLibraryVersion",
"com.android.support:mediarouter-v7:$supportLibraryVersion"
}
}
android {
compileSdkVersion global_compileSdkVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_compileSdkVersion
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
signingConfigs {
debug {
...
}
release {
...
}
}
flavorDimensions "store", "brand"
productFlavors {
all {
ext.flavor = null
}
google {
...
}
amazon {
...
}
app1 {
dimension "brand"
signingConfig signingConfigs.release
}
app2 {
dimension "brand"
signingConfig signingConfigs.release
}
}
compileJavacc {
inputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
}
compileJjtree {
inputDirectory = file('javacc')
outputDirectory = file(project.buildDir.absolutePath + '/generated/javacc')
}
sourceSets {
test {
java.srcDir file('tests')
}
androidTest {
java.srcDir file('androidTest')
}
main {
manifest.srcFile 'AndroidManifest.xml'
assets.srcDirs = ['assets']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
java.srcDirs = ['src', 'build/generated/javacc']
}
google {
manifest.srcFile 'flavors/google/AndroidManifest.xml'
aidl.srcDirs = ['flavors/google/src']
}
googleApp1 {
java.srcDirs = ['flavors/google/src', 'flavors/googleApp1/src']
res.srcDirs = ['flavors/google/res', 'flavors/googleApp1/res']
assets.srcDirs = ['assets', 'flavors/app1/assets', 'flavors/googleApp1/assets']
}
googleApp2 {
java.srcDirs = ['flavors/google/src', 'flavors/googleApp2/src']
res.srcDirs = ['flavors/google/res', 'flavors/googleApp2/res']
assets.srcDirs = ['assets', 'flavors/app2/assets', 'flavors/googleApp2/assets']
}
amazon {
manifest.srcFile 'flavors/amazon/AndroidManifest.xml'
}
amazonApp1 {
...
}
amazonApp2 {
...
}
app1 {
manifest.srcFile 'flavors/app1/AndroidManifest.xml'
res.srcDirs = ['flavors/app1/res']
java.srcDirs = ['flavors/app1/src']
}
app2 {
manifest.srcFile 'flavors/app2/AndroidManifest.xml'
res.srcDirs = ['flavors/app2/res']
java.srcDirs = ['flavors/app2/src']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
crashlytics {
...
}
}
debug {
ext.enableCrashlytics = false
minifyEnabled false
...
}
}
dexOptions {
javaMaxHeapSize "3g"
}
lintOptions {
abortOnError false
}
externalNativeBuild {
ndkBuild {
path "../jni/Android.mk"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
amazonImplementation fileTree(dir: 'flavors/amazon/libs', include: '*.jar')
googleImplementation fileTree(dir: 'flavors/google/libs', include: '*.jar')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.google.firebase:firebase-core:17.2.1"
implementation "com.google.firebase:firebase-ads:18.3.0"
implementation "com.google.firebase:firebase-messaging:20.0.0"
implementation "com.google.firebase:firebase-analytics:17.2.1"
implementation "com.google.android.gms:play-services-ads:18.3.0"
implementation "com.google.android.gms:play-services-analytics:17.0.0"
implementation "com.google.android.gms:play-services-auth:17.0.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0"
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'com.google.android.libraries.cast.companionlibrary:ccl:2.9.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.facebook.android:facebook-login:5.0.2'
implementation('com.facebook.android:audience-network-sdk:5.5.0') {
exclude module: 'exoplayer-core'
exclude module: 'exoplayer-dash'
}
api 'com.google.guava:guava:27.0.1-android' // when updating use the -android version
// Ads
implementation('com.vungle:publisher-sdk-android:6.3.24@aar') {
transitive=true
}
implementation 'com.google.ads.mediation:vungle:6.3.24.0'
implementation 'com.applovin:applovin-sdk:8.1.4'
implementation 'com.adcolony:sdk:3.3.5'
implementation 'com.unity3d.ads:unity-ads:3.0.0'
implementation 'com.google.ads.mediation:facebook:5.1.0.0'
implementation 'com.google.ads.mediation:chartboost:7.3.0.0'
implementation 'com.google.ads.mediation:applovin:8.1.4.0'
implementation 'com.google.ads.mediation:adcolony:3.3.5.1'
implementation 'com.google.ads.mediation:unity:3.0.0.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
// Etc.
implementation 'com.googlecode.mp4parser:isoparser:1.1.22'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'androidx.multidex:multidex:2.0.0' // check on low API before updating
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { transitive = true; }
implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.1.0@aar') { transitive = true }
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'com.parse.bolts:bolts-android:1.4.0'
implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.21.0'
implementation 'com.amazonaws:aws-android-sdk-core:2.9.1'
implementation 'com.amazonaws:aws-android-sdk-s3:2.9.1'
implementation 'com.github.anrwatchdog:anrwatchdog:1.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0' // support kotlin before updating
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
implementation ('eu.livotov.labs.android:CAMView:2.0.2@aar') { transitive = true }
implementation 'pub.devrel:easypermissions:3.0.0'
implementation 'com.rockerhieu:rv-adapter-endless:1.2'
googleImplementation 'com.google.android.exoplayer:exoplayer:2.8.2'
amazonImplementation 'com.amazon.android:exoplayer:2.8.2'
implementation('com.google.android.exoplayer:extension-okhttp:2.8.2') { transitive = false }
implementation 'com.airbnb.android:lottie:2.5.6'
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.github.florent37:viewanimator:1.0.5'
implementation 'com.github.lamydev:android-notification:3.0'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation 'com.appsflyer:af-android-sdk:4.9.0'
implementation 'com.android.installreferrer:installreferrer:1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'org.powermock:powermock-mockito-release-full:1.6.4'
testImplementation 'org.json:json:20140107'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
注意我有多层次的口味。我已将详细信息修改为 app1 和 app2。
检查这些文件是否存在格式错误XML。查看导致此错误的各种问题
这个 build.gradle
不完全是 MVCE, but quite cluttered, which does not help much with reproducing the issue. And that should rather be androidx.lifecycle
。虽然您应该摆脱 resolutionStrategy
force
并正确修复此问题,但 最终 与相应包上的 exclude group: "com.android.support"
,因为它可能会干扰。尝试 运行ning ./gradlew app:dependencies > dependencies.txt
(或任何模块名称)以获得更多见解。我怀疑这个包裹(无论它打算修复什么):
implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0"
As it seems,没有 androidx.legacy:legacy-preference-v14
的版本 1.1.0
,因此保留 androidx.preference:preference:1.0.0
。 build.gradle
甚至没有任何版本 1.1.0
,这使得问题更难重现。其中一个长 运行,将 dependencies
分为当前的和仍在使用 com.android.support
的
如果您可以提供一个 最小 示例(可以简单地复制并粘贴到 build.gradle
并让它崩溃),那么我可能会提供一个更准确的答案。
可能的解决方案:
使缓存无效并重新启动 Android Studio。
此外,我在构建发布版 APK 时遇到了同样的问题 从修改构建脚本后解析的构建管道 ./gradlew assembleRelease 到 ./gradlew app:assembleRelease
检查 official doc for changes,有几个重要的 changes/improvements 可能会影响。
改变
implementation 'com.takisoft.fix:preference-v7:28.0.0.0'
到
implementation 'com.takisoft.preferencex:preferencex:1.1.0'