美文网首页
React Native打包Android报错:AAPT: e

React Native打包Android报错:AAPT: e

作者: Volon | 来源:发表于2019-08-23 17:11 被阅读0次
    报错截图: WX20190823-170050@2x.png

    版本信息:
    1.android/build.gradle

    buildscript {
        ext {
            buildToolsVersion = "27.0.3"
            minSdkVersion = 16
            compileSdkVersion = 27
            targetSdkVersion = 27
            supportLibVersion = "27.0.3"
    
        }
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.4'
             classpath "com.google.gms:google-services:3.1.2"
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    

    2.android/gradle.properties

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
    

    解决方案:

    在android/build.gradle中加上以下代码:

    subprojects {
        afterEvaluate {project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion 27
                    buildToolsVersion "27.0.3"
                }
            }
            configurations.all {
                            resolutionStrategy {
                                force 'com.google.android.gms:play-services-gcm:16.1.0'
                                force 'com.google.android.gms:play-services-location:16.0.1'
                                force 'com.google.android.gms:play-services-basement:16.2.0'
                                force 'com.google.android.gms:play-services-auth:16.0.1'
                                force 'com.google.android.gms:play-services-stats:16.0.1'
                                force 'com.google.android.gms:play-services-base:16.0.1'
                            }
                        }
        }
    }
    
    

    相关文章

      网友评论

          本文标题:React Native打包Android报错:AAPT: e

          本文链接:https://www.haomeiwen.com/subject/vsbtectx.html