gpt4 book ai didi

android - react native : Android Debug build does't loads image assets from the react-native assets folder

转载 作者:太空宇宙 更新时间:2023-11-03 13:41:23 25 4
gpt4 key购买 nike

为了测试和共享目的,我在终端中使用以下代码创建了一个 apk

react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debugScanning

并使用

创建apk
Create debug build:
cd android
./gradlew assembleDebug

上述解决方案来自成功创建了一个好的 apk 文件的 stackoverflow,

但是,当我测试 apk 时,它不显示文件夹中的图标

"react-native-project-name/assets" 

只显示空白而不是图标。测试了一些解决方案,但注意到解决了这个问题。

版本

react-native-cli: 2.0.1
react-native: 0.55.4

最佳答案

可能有两种情况:

1-检查 ${project}/android/app/src/res,如果 imgs 不在那里,也许你应该在项目根目录中手动运行此命令以复制 imgs:react-native bundle --platform android --dev false --entry-file index.android.js\--bundle-output android/app/src/main/assets/index.android.bundle\--assets-dest android/app/src/main/res/.

2-问题可能出在图像尺寸上。我有一个很大的本地 .png 并试图将其调整为一个小缩略图,但它不会显示。 iOS 会处理它,Android 不会。

https://github.com/facebook/react-native/issues/9451

关于android - react native : Android Debug build does't loads image assets from the react-native assets folder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51192385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com