Error: Duplicate resources — Failed to generate Signed APK in Android studio #1097
Comments
ajitdas123 commented Nov 15, 2019
|
A similar issue has been raised before for IOS #1074
Environment
OS: Android
React native: 0.60.5
react-native-vector-icons: 6.6.0
Description
When I was trying to generate signed APK with Android Studio, I am getting duplicate resource error.
Error log:
[raw/node_modules_reactnativevectoricons_glyphmaps_feather] /Users/ad/Documents/react-native-project/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_feather.json [raw/node_modules_reactnativevectoricons_glyphmaps_feather] /Users/ad/Documents/react-native-project/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_feather.json: Error: Duplicate resources
[raw/app] /Users/ad/Documents/react-native-project/android/app/src/main/res/raw/app.json [raw/app] /Users/ad/Documents/react-native-project/android/app/build/generated/res/react/release/raw/app.json: Error: Duplicate resources
[raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome] /Users/ad/Documents/react-native-project/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome.json [raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome] /Users/ad/Documents/react-native-project/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome.json: Error: Duplicate resources
[raw/node_modules_reactnativevectoricons_glyphmaps_zocial] /Users/ad/Documents/react-native-project/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_zocial.json [raw/node_modules_reactnativevectoricons_glyphmaps_zocial] /Users/ad/Documents/react-native-project/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_zocial.json: Error: Duplicate resources
[raw/node_modules_reactnativevectoricons_glyphmaps_entypo] /Users/ad/Documents/react-native-project/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_entypo.json [raw/node_modules_reactnativevectoricons_glyphmaps_entypo] /Users/ad/Documents/react-native-project/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_entypo.json: Error: Duplicate resources
Can anyone please tell me how can I resolve this.
The text was updated successfully, but these errors were encountered:
Источник
React Native : Error: Duplicate resources — Android
Problem:
I was trying to create a release apk file from Android but when I create a release apk with PNG image I’m getting Duplicate Resource error. Initially I thought this is happening because I made a mistake in the existing project but when I created a new project with a single Image component itself I’m getting the Duplicate Resource error. Here are the steps I followed
- Create a app — react-native init demo
- Create a assets folder in the project root folder.
- Add a PNG image inside the assets folder.
- Now implement the Image component with the above PNG image.
Now bundle it using the cmd
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/
Then generate release apk using Generate Signed APK from Android Studio .
This will throw the following error:
Note: When you generate a release apk without any PNG image you will not get any error, it will create you the release apk .
Here are the other files code.
App.js
package.json
Any solution for this?
Update:
Here are the other details
Tried with Android Studio 3.0, 3.0.1, 3.1, 3.1.4 & 3.2
Solution:
This solution works for me
In my case, build failed because there is a duplicated resources in my Android project (inside android folder), these two lines is necessary to remove duplicated resources, that’s it.
Источник