• [RN] React Native : Failed to execute aapt


    这是我在开发 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

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

  • 相关阅读:
    正则表达式 \n和\r
    【转】单循环赛赛程安排算法研究
    Iterator效率
    Map获取键值
    PL/SQL语法详解(pdf)
    Iterator模式
    测试js函数的静态页面
    【转】java的一些基本概念
    Oracle 11g用户解锁
    oracle官方文档
  • 原文地址:https://www.cnblogs.com/wukong1688/p/10885877.html
Copyright © 2020-2023  润新知