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

報錯截圖:
在這裏插入圖片描述

版本信息:
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'
                        }
                    }
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章