I am building a release APK of my React Native app in Android using Gradle version 3.2.0 and compileSdkVersion 28. I am running the following commands:
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/
cd android && ./gradlew clean && ./gradlew assembleRelease && ./gradlew installRelease
My folder structure is:
My package.json is:
{
"name": "App",
"version": "2.0.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"axios": "^0.18.0",
"native-base": "^2.8.0",
"prop-types": "^15.6.2",
"qs": "^6.5.2",
"react": "^16.5.2",
"react-native": "0.57.0",
"react-native-animatable": "^1.3.0",
"react-native-animated-icons": "^1.0.5",
"react-native-appsee": "^2.4.14",
"react-native-blur": "^3.2.2",
"react-native-cast-chrome": "1.0.0",
"react-native-cast-ui": "1.0.0",
"react-native-device-info": "^0.22.3",
"react-native-dialog": "^5.1.0",
"react-native-elements": "^0.19.1",
"react-native-email": "^1.0.1",
"react-native-fast-image": "^5.0.3",
"react-native-fbsdk": "^0.8.0",
"react-native-flurry-analytics": "^3.0.2",
"react-native-gridview": "^0.1.2",
"react-native-iap": "^2.2.1",
"react-native-iphone-x-helper": "^1.0.3",
"react-native-keyboard-aware-scroll-view": "^0.7.0",
"react-native-kochava-tracker": "^1.0.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-material-dropdown": "^0.11.1",
"react-native-modal": "^6.5.0",
"react-native-orientation": "^3.1.3",
"react-native-photo-upload": "^1.3.0",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-snap-carousel": "^3.7.4",
"react-native-tab-view": "^1.2.0",
"react-native-underline-tabbar": "^1.3.6",
"react-native-vector-icons": "^5.0.0",
"react-native-video": "^3.2.1",
"react-native-video-controls": "^2.2.3",
"react-navigation": "^2.11.2",
"react-navigation-backhandler": "^1.1.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/plugin-external-helpers": "^7.0.0",
"ajv": "^6.5.2",
"babel-eslint": "^9.0.0",
"babel-jest": "23.4.2",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^5.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.0",
"jest": "23.4.2",
"metro-react-native-babel-preset": "^0.45.4",
"react-test-renderer": "16.4.1",
"schedule": "^0.4.0"
},
"jest": {
"preset": "react-native"
}
}
While ruuning the commands, I get error on Task :app:mergeReleaseResources FAILED with Error: Duplicate resources for all of my assets. When removing the assets from my drawable folders, the app builds.
But while running the release APK, some of the images are not appearing at all while others are. Furthermore, the same image is appearing in some places while not appearing in others. None of these problems happen while running the debug app from the JS server. This problem is not happening in iOS.
How do I solve this problem?
