首页 > 其他 > 详细

[RN] React Native : Failed to execute aapt

时间:2019-05-18 15:54:54      阅读:139      评论:0      收藏:0      [点我收藏+]

这是我在开发 React Native

本地 Android Studio 3.1.4 时

构建 release 版本失败,而开发环境正常

之前用 Android Studio 2.*  未出现此问题!

 

版本信息:

"react": "16.6.3",
"react-native": "0.57.8",

 

解决方法:

编辑 android/gradle.build

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

 

增加 红色 代码 即可!

 

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10885877.html

转载请著名出处!谢谢~~

[RN] React Native : Failed to execute aapt

原文:https://www.cnblogs.com/wukong1688/p/10885877.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!