9

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

 3 years ago
source link: https://renyugang.blog.csdn.net/article/details/87657104
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

胖虎 2019-02-18 23:59:58 18981

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'
            }
        }
    }
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK