Reputation: 891
Our android project works fine after porting to androidx a while ago.
Now I tried upgrading the androidx.preference.preference from 1.0.0 to 1.1.0 - that is the only change I do - and I get these missing resources errors:
> 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.
Here is a stripped down copy of my 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"
}
Notice that I have multi level flavors. I have modified details into app1 and app2.
Upvotes: 0
Views: 1191
Reputation: 1
Change
implementation 'com.takisoft.fix:preference-v7:28.0.0.0'
to
implementation 'com.takisoft.preferencex:preferencex:1.1.0'
Upvotes: 0
Reputation: 711
Possible solution:
Invalidate caches and restart Android Studio.
Moreover, I have faced the same issue while building release APK from build pipeline which resolved after modifying build script from ./gradlew assembleRelease to ./gradlew app:assembleRelease
Checkout official doc for changes, there are few important changes/improvements which might impact.
Upvotes: 0
Reputation: 76799
This build.gradle
is not exactly an MVCE, but quite cluttered, which does not help much with reproducing the issue. And that should rather be androidx.lifecycle
. While you should get rid of resolutionStrategy
force
and instead fix this properly, eventually with exclude group: "com.android.support"
on the corresponding package, because it may interfere. Try running ./gradlew app:dependencies > dependencies.txt
(or whatever the module name might be) for some more insight. I'd have this one package under suspicion (whatever it may intend to fix):
implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0"
As it seems, there is no version 1.1.0
of androidx.legacy:legacy-preference-v14
, therefore keeping androidx.preference:preference:1.0.0
. That build.gradle
doesn't even feature any version 1.1.0
, which makes the issue even less reproducible. One the long run, it might make sense to sort the dependencies
into current ones and ones that still use com.android.support
.
In case you could provide a minimal example (which one can simply copy & paste into a build.gradle
and let it crash), then I possibly could provide a more accurate answer.
Upvotes: 2