zoukankan      html  css  js  c++  java
  • [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

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

  • 相关阅读:
    oracle中的游标
    Oracle中的表空间
    Oracle中建表及表操作
    oracle中的权限管理
    oracle中的数据类型
    Oracle中常用的系统函数
    oracle中的dual表简介
    Oracle中常用的系统表
    Git常用命令总结
    Git配置文件与git config命令
  • 原文地址:https://www.cnblogs.com/wukong1688/p/10885877.html
Copyright © 2011-2022 走看看