0

The app works perfectly with the emulator when I run react-native run android but when I try generating the apk it shows the following errorenter image description here

Don't know what the problem is It works flawlessly in the emulator

Ronak Khandelwal
  • 301
  • 2
  • 16

2 Answers2

0

It's difficult to know just like that what's the error... Did you follow all the steps ? :

=> keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

=> Place the my-release-key.keystore file under the android/app

=> Edit the file ~/.gradle/gradle.propertieswith the informations you create(store and key password).
MYAPP_RELEASE_STORE_PASSWORD=***** MYAPP_RELEASE_KEY_PASSWORD=*****

=> Edit the file android/app/build.gradle to enable release version... like this :

=> ... android { ... defaultConfig { ... } signingConfigs { release { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } buildTypes { release { ... signingConfig signingConfigs.release } } } ...



=> And finishing , go on main repo and run this : $ cd android && ./gradlew assembleRelease

=> The generated APK can be found under android/app/build/outputs/apk/app-release.apk



All the precise informations can be found here : https://facebook.github.io/react-native/docs/signed-apk-android.html#content

Mayoul
  • 626
  • 10
  • 24
0

So i finally found the answer I had to delete default.png file and rename the reference in js files don't know what caused the error. But deleting the file in res folder seemed to be a workaround, if anyone finds the cause do tell me but for now the problem is resolved

Ronak Khandelwal
  • 301
  • 2
  • 16