React Native打包Android报错:AAPT: error: resource android:attr/fontVariationSettings not found.

报错截图:
WX20190823-170050@2x.png

版本信息:
1.android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 27
        supportLibVersion = "27.0.3"

    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
         classpath "com.google.gms:google-services:3.1.2"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

2.android/gradle.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

解决方案:

在android/build.gradle中加上以下代码:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion "27.0.3"
            }
        }
        configurations.all {
                        resolutionStrategy {
                            force 'com.google.android.gms:play-services-gcm:16.1.0'
                            force 'com.google.android.gms:play-services-location:16.0.1'
                            force 'com.google.android.gms:play-services-basement:16.2.0'
                            force 'com.google.android.gms:play-services-auth:16.0.1'
                            force 'com.google.android.gms:play-services-stats:16.0.1'
                            force 'com.google.android.gms:play-services-base:16.0.1'
                        }
                    }
    }
}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容