反应本机重复资源 [英] React Native Duplicate resources

查看:102
本文介绍了反应本机重复资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到React Native 0.57之后,我在react-native-router-flux中生成APK时遇到了一个问题.当执行.\ gradlew assembleRelease时,我遇到以下错误:-

After upgrading to React Native 0.57 i am facing an issue when genrating APK in react-native-router-flux.when executing the .\gradlew assembleRelease i get below error :-

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> [drawable-mdpi-v4/node_modules_reactnativerouterflux_images_back_chevron] 
R:\Workings\lisecapps\androidrepo\test-react- 
native\venutest\android\app\src\main\res\drawable- 
mdpi\node_modules_reactnativerouterflux_images_back_chevron.png      
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_back_chevron] 
R:\Workings\lisecapps\androidrepo\test-react- 
emirnative\venutest\android\app\build\generated\res\react\release\drawable- 
mdpi-v4\node_modules_reactnativerouterflux_images_back_chevron.png: Error: 
Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_menu_burger] 
R:\Workings\lisecapps\androidrepo\test-react-nat 
ive\venutest\android\app\src\main\res\drawable- 
mdpi\node_modules_reactnativerouterflux_images_menu_burger.png        
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_menu_burger] 
R:\Workings\lisecapps\androidrepo\test-react- 
native\venutest\android\app\build\generated\res\react\release\drawable-mdpi- 
v4\node_modules_reactnativerouterflux_images_menu_burger.png: Error: 
Duplicate resources

我尝试了以下方法来解决,但仍然是相同的错误:-

I tried the following to resolve but still same error :-

  • Tried to create script as said in the first answer here to avoid duplicate copying of asset images.
  • Deleted the whole app/build folder

推荐答案

您需要删除生成的资源/可绘制对象并重新生成.

You need remove generated resources/drawable and generate again.

rm -rf android/app/src/main/res/drawable-*
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

然后再次编译android react-native run-android

And compile android again react-native run-android

这篇关于反应本机重复资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆