zoukankan      html  css  js  c++  java
  • React Native 打包异常:Android resource linking failed(原创)

    异常原文:

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':react-native-orientation:verifyReleaseResources'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
       > Android resource linking failed
         /root/.gradle/caches/transforms-2/files-2.1/1ebe56e8a2698b86e38474ff767fc615/appcompat-1.0.2/res/values-v26/values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/1ebe56e8a2698b86e38474ff767fc615/appcompat-1.0.2/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/1ebe56e8a2698b86e38474ff767fc615/appcompat-1.0.2/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/1ebe56e8a2698b86e38474ff767fc615/appcompat-1.0.2/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/1ebe56e8a2698b86e38474ff767fc615/appcompat-1.0.2/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontStyle not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/font not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontWeight not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/startX not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/startY not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/endX not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/endY not found.
             
         /root/.gradle/caches/transforms-2/files-2.1/b633e8a572c08ec36267fa720bdc9a9b/core-1.0.1/res/values/values.xml:126:5-132:25: AAPT: error: resource android:attr/offset not found.
             
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD FAILED in 1m 11s
    814 actionable tasks: 235 executed, 498 from cache, 81 up-to-date

    解决方案:

    在node_modules文件夹下找到插件位置, android/build.gradle可以看到:

    修改红色字体属性(compileSdkVersion、buildToolsVersion、minSdkVersion、targetSdkVersion)的值为绿色的值

    android {
        compileSdkVersion rootProject.ext.compileSdkVersion
        buildToolsVersion rootProject.ext.buildToolsVersion
     
        defaultConfig {
            minSdkVersion rootProject.ext.minSdkVersion
            targetSdkVersion rootProject.ext.targetSdkVersion
            versionCode 1
            versionName "1.0"
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }
        }

    gradle clean后重新打包。

  • 相关阅读:
    vue项目在IE中使用的一些坑(未完待续)
    Vue在IE下显示空白问题
    nginx 解决AJAX 跨域问题。
    node.js+express+jade 国际化
    Angular 2 HTTP Requests with Promise
    Windows x64编译 Qt5.7 Mysql驱动
    mysql [Err] 1215
    VS Code 调试Node.js express网站
    Node.js express 入门示例1
    build qt4.8.5 on centos7 or suse11.1
  • 原文地址:https://www.cnblogs.com/Denny_Yang/p/14215128.html
Copyright © 2011-2022 走看看