react-native - 任务 ':app:processDebugResources' 执行失败。 > 安卓资源链接失败可以再构建RN安卓版

标签 react-native gradle react-native-android

我的 React native 应用程序的 android 版本现在拒绝构建。我已按照 post 中的建议将已编译的SKD 版本更新为 28。 .

这是我尝试在物理设备上构建时遇到的错误:

  • What went wrong: Execution failed for task ':app:processDebugResources'.

    Android resource linking failed Output: /Users/someguy/projects/third/someapp/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:422: error: resource android:attr/fontVariationSettings not found.
    /Users/someguy/projects/third/someapp/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:422: error: resource android:attr/ttcIndex not found. error: failed linking references. Command: /Users/someguy/.gradle/caches/transforms-1/files-1.1/aapt2-3.5.0-alpha03-5252756-osx.jar/d3ea99fc2d1356bcc9bc022a544dfd8b/aapt2-3.5.0-alpha03-5252756-osx/aapt2 link -I\ /Users/someguy/Library/Android/sdk/platforms/android-26/android.jar\ --manifest\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\ -o\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\ -R\ @/Users/someguy/projects/third/someapp/android/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ /Users/someguy/projects/third/someapp/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\ --proguard-main-dex\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/legacy_multidex_aapt_derived_proguard_rules/debug/processDebugResources/manifest_keep.txt\ --custom-package\ com.someapp\ -0\ apk\ --output-text-symbols\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/symbols/debug/R.txt\ --no-version-vectors Daemon: AAPT2 aapt2-3.5.0-alpha03-5252756-osx Daemon #0 Output: /Users/someguy/.gradle/caches/transforms-1/files-1.1/drawee-1.3.0.aar/cdd2e6e5cf23d268c647bf7bca6ef749/res/values/values.xml:3:5-53:675: AAPT: error: resource android:attr/fontVariationSettings not found. /Users/someguy/.gradle/caches/transforms-1/files-1.1/drawee-1.3.0.aar/cdd2e6e5cf23d268c647bf7bca6ef749/res/values/values.xml:3:5-53:675: AAPT: error: resource android:attr/ttcIndex not found. error: failed linking references. Command: /Users/someguy/.gradle/caches/transforms-1/files-1.1/aapt2-3.5.0-alpha03-5252756-osx.jar/d3ea99fc2d1356bcc9bc022a544dfd8b/aapt2-3.5.0-alpha03-5252756-osx/aapt2 link -I\ /Users/someguy/Library/Android/sdk/platforms/android-26/android.jar\ --manifest\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\ -o\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\ -R\ @/Users/someguy/projects/third/someapp/android/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ /Users/someguy/projects/third/someapp/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\ --proguard-main-dex\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/legacy_multidex_aapt_derived_proguard_rules/debug/processDebugResources/manifest_keep.txt\ --custom-package\ com.someapp\ -0\ apk\ --output-text-symbols\ /Users/someguy/projects/third/someapp/android/app/build/intermediates/symbols/debug/R.txt\ --no-version-vectors Daemon: AAPT2 aapt2-3.5.0-alpha03-5252756-osx Daemon #0

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
  • https://help.gradle.org 获得更多帮助


  • 5 秒内构建失败 133 个可操作的任务:2 个已执行,131 个是最新的

    我还仔细检查了我的 AndroidManifest.xml 文件,看看我是否有此 post 中建议的任何悬挂括号。

最佳答案

您是否运行了捆绑命令?

sudo react-native bundle --platform android --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --dev false --reset-cache --assets-dest android/app/src/main/res/

并关闭现有打包器并重新打开打包器。

关于react-native - 任务 ':app:processDebugResources' 执行失败。 > 安卓资源链接失败可以再构建RN安卓版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56643133/

相关文章:

java - 如何将依赖项打包到输出 jar 中?

react-native - 使用 POST 时不支持 Source.headers

javascript - react native 句柄翻译和语言

javascript - 如何插入数组或值的对象并传输到新数据

reactjs - FlatList 调用两次

scala - 在 Java、Scala 或 Kotlin 的生态系统中,是否有一种可靠的方法来重新打包库依赖项以避免版本冲突?

gradle - 如何在Gradle的子项目中构建所有项目?

react-native - react 原生 map 标记自定义图像无法从默认更改

react-native - 在 React Native Android 中如何在应用程序后台检查互联网连接在线/离线?

javascript - React-Native Mapbox 不显示用户位置和注释