当前位置: 首页 > 工具软件 > :attr > 使用案例 >

AAPT: error: resource android:attr/fontVariationSettings not found

郤旭东
2023-12-01

Android Studio中提示的错误Log:

/Users/lijiangping/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/c85964a61f36e1b83cfed8dc0b27cbc1/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.
    
/Users/lijiangping/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/c85964a61f36e1b83cfed8dc0b27cbc1/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found.

引起的原因:项目中引入了多个aar,每个aar对应了不同的appcompat-v7版本,为了不引起错误,我们会设置force某个版本,但是问题就在这边,需要设置最高版本保证其他aar中引用的高资源内容不会因为我们设置低版本而出错。

/Users/lijiangping/MyProject/PP/framework/build.gradle: Error: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1, 25.2.0. Examples include com.android.support:collections:28.0.0 and com.android.support:animated-vector-drawable:27.1.1 [GradleCompatible]

因此我们需要将我们的appcompat-v7版本force为这些aar中最高的版本:28.0.0

在build.gradle中加入:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.0.0'
            }
        }
    }
}
 类似资料:

相关阅读

相关文章

相关问答