找不到资源android:attr / dialogCornerRadius

时间:2019-10-02 11:20:50

标签: android react-native

我最近使用以下代码构建项目时开始出现此错误:

./gradlew app:assembleRelease

  

任务:app:processReleaseResources失败

     

失败:生成失败,发生异常。    什么地方出了错:   任务':app:processReleaseResources'的执行失败。    Android资源链接失败    C:\ Users \ Matt.gradle \ caches \ transforms-2 \ files-2.1 \ 51c1e76c432ad37ab506722307c9002f \ res \ values-v28 \ values-v28.xml:9:5-12:13:AAPT:错误:资源android:attr /没有找到dialogCornerRadius。

     

C:\ Users \ Matt \ sites \ tcapp \ android \ app \ build \ intermediates \ incremental \ mergeReleaseResources \ merged.dir \ values-v28 \ values-v28.xml:11:AAPT:错误:资源android:attr / dialogCornerRadius找不到。

     

C:\ Users \ Matt.gradle \ caches \ transforms-2 \ files-2.1 \ 9f7be746be69bf3adf6576c7401d0fc4 \ res \ values \ values.xml:3:5-58:857:AAPT:错误:资源android:attr / fontVariationSettings找不到。

     

C:\ Users \ Matt.gradle \ caches \ transforms-2 \ files-2.1 \ 9f7be746be69bf3adf6576c7401d0fc4 \ res \ values \ values.xml:3:5-58:857:AAPT:错误:资源android:attr / ttcIndex找不到。

     

错误:链接引用失败。

app.build.gradle:

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.rg.tc"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 2
        versionName "2.0"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
         release {
              if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile rootProject.file("app/" + project.findProperty('MYAPP_RELEASE_STORE_FILE') ?: "ANDROID_STORE_FILE_NOT_SET")
                storePassword project.findProperty('MYAPP_RELEASE_STORE_PASSWORD') ?: "ANDROID_STORE_PASSWORD_NOT_SET"
                keyAlias project.findProperty('MYAPP_RELEASE_KEY_ALIAS') ?: "ANDROID_KEY_ALIAS_NOT_SET"
                keyPassword project.findProperty('MYAPP_RELEASE_KEY_PASSWORD') ?: "ANDROID_KEY_PASSWORD_NOT_SET"
              }

            }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation project(':react-native-youtube')
    implementation project(':react-native-webview-bridge')
    implementation project(':react-native-webview')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-svg')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-share')
    implementation project(':react-native-gesture-handler')
    implementation project(':@react-native-community_async-storage')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

build.gradle:

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.0")

        // 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 27 
                buildToolsVersion '27.0.3'
            }
        }
    }
}

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

0 个答案:

没有答案