【发布时间】:2017-11-24 03:08:49
【问题描述】:
使用 gradle-plugin 3.0.0 Gradle 分发版 4.1.0 反应原生 0.50 Linux fedora 27
应用名称是 u1b。 项目结构 /proj/mob/rn.common (这是 node_modules 和我所有与 js 相关的东西的地方) /proj/mob/a/u1b -- 是 android 应用所在的位置。
项目结构不同于通常由样板 react-native create app 脚本创建的项目结构(因为我的 node_modules 不仅仅是 android 应用程序的上一级)。 但不清楚这是否是一个问题。
我一直在调试模式下使用 react-native 库构建我的 android。 现在是时候开始构建发布了。 但是我遇到了问题
bash gradlew assembleRelease 错误出来:
> Task :app:bundleReleaseJsAndAssets
Scanning folders for symlinks in /home/v/devel/mine/proj/mob/rn.common/node_modules (12ms)
Scanning folders for symlinks in /home/v/devel/mine/proj/mob/rn.common/node_modules (9ms)
Loading dependency graph, done.
warning: the transform cache was reset.
bundle: start
bundle: finish
bundle: Writing bundle output to: /home/v/tmp/u1b/app/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
bundle: Copying 18 asset files
bundle: Done copying assets
/home/v/tmp/u1b/app/intermediates/res/merged/release/drawable-mdpi/src_jsapp_img_material_ic_local_library_black_48dp_android_drawablexxhlack_48dp.png: **error: Invalid filename. Unable to add.**
它正在查看的图像文件确实不存在。但是我不知道该文件名是如何构造的,以及为什么它正在寻找它。
我的 gradle.properties 包含一个标志,用于由于错误而切换到旧 apk
# https://github.com/react-community/react-navigation/issues/1976
android.enableAapt2=false
有人可以说明图像名称是如何确定的以及可能导致错误的原因
谢谢
【问题讨论】:
-
如您所说,项目结构与使用 react-native cli 创建的项目结构不同。您有任何自定义库/字体将其与 react-native 链接链接吗? (即,任何使用 ios/android 原生模块的库?)
-
我有一个自定义库,它只是 java 源代码(没有字体/图像/等),基本上是一个只处理一些 json 内容的函数。我创建了一个符号链接,以“模拟”本机 cli 创建的 dir 结构的方式指向我的 node_modules。这个特殊问题发生在我这样做之后