美文网首页程序员
安卓打包报错Execution failed for task

安卓打包报错Execution failed for task

作者: 双轮自行车 | 来源:发表于2019-03-07 16:23 被阅读0次

    安卓打包会报这种错误:

    这个是只有打包apk时才会出现的错误,需要注意两个地方来确定你的错误和我遇到的是同一类错误:
    1."verifyReleaseResources"
    2."Aapt2Exception"

    解决方案

    1.首先在node_modules中找到报错的包里面的build.gradle,比如我这个就是\node_modules\react-native-version-number\android\build.gradle;

    2.修改这个build.gradle,使其与android/build.gradle(也可能是android/app/build.gradle)里面的SDK版本保持一致;

    3.将build.gradle里的compile改为implementation,因为compile已过时。

    android {
        compileSdkVersion 27 // 23 -> 27
        buildToolsVersion "27.0.3" // 23.0.1 -> 27.0.3
     
        defaultConfig {
            minSdkVersion 16
            targetSdkVersion 26 // 22 -> 26
            versionCode 1
            versionName "1.0"
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }
        }
        lintOptions {
           warning 'InvalidPackage'
        }
    }
     
    dependencies {
        implementation 'com.facebook.react:react-native:+' // compile -> implementation
    }
    
    

    然后重新发布就好了。

    相关文章

      网友评论

        本文标题:安卓打包报错Execution failed for task

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