React Native: Failed to execute aapt

3338 단어
설명:release 버전 구축 실패, 개발 환경 정상
버전 정보:
[email protected]
[email protected]

오류 정보:
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found. C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found. C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found. C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found. C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/font not found. C:\Users
odece\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\41458edcfa3aa3330042a7673ace2ab9\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found. error: failed linking references. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-wechat:verifyReleaseResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

해결 방안:android/gradle를 수정합니다.build
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

//  
subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion     //do this in android/app/build.gradle too
                buildToolsVersion rootProject.ext.buildToolsVersion     //do this in android/app/build.gradle too
            }
        }
    }
}
//  

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

좋은 웹페이지 즐겨찾기