链接资源丢失错误,将androidx偏好从1.0.0更新到1.1.0

问题描述 投票:0回答:2

[我们的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。

android android-preferences androidx
2个回答
0
投票

检查这些文件中是否有格式错误的XML。查看导致此错误的各种问题here


0
投票

build.gradle并不完全是MVCE,但非常混乱,这对于重现此问题没有太大帮助。那应该是androidx.lifecycle。虽然您应该摆脱androidx.lifecycle resolutionStrategy并正确地解决此问题,但是最终用相应包装上的force。尝试运行exclude group: "com.android.support"(或任何模块/风味名称),以获取更多信息。我会怀疑这个包(不管它打算如何修复):

./gradlew app:dependencies > dependencies.txt

[implementation "com.takisoft.fix:preference-v7:$rootProject.supportLibraryVersion.0" ,没有As it seems的版本1.1.0

© www.soinside.com 2019 - 2024. All rights reserved.