Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

android - React Native Duplicate resources

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:Workingslisecappsandroidrepoest-react- 
nativevenutestandroidappsrcmain
esdrawable- 
mdpi
ode_modules_reactnativerouterflux_images_back_chevron.png      
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_back_chevron] 
R:Workingslisecappsandroidrepoest-react- 
emirnativevenutestandroidappuildgenerated
es
eact
eleasedrawable- 
mdpi-v4
ode_modules_reactnativerouterflux_images_back_chevron.png: Error: 
Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_menu_burger] 
R:Workingslisecappsandroidrepoest-react-nat 
ivevenutestandroidappsrcmain
esdrawable- 
mdpi
ode_modules_reactnativerouterflux_images_menu_burger.png        
[drawable-mdpi-v4/node_modules_reactnativerouterflux_images_menu_burger] 
R:Workingslisecappsandroidrepoest-react- 
nativevenutestandroidappuildgenerated
es
eact
eleasedrawable-mdpi- 
v4
ode_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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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/

And compile android again react-native run-android


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...