Bakhrom Achilov
Bakhrom Achilov

Reputation: 157

React Native bundle in release APK is not working

I'm newbie in RN. I have a problem with building release APK. I'm doing following steps:

  1. rm -rf node_modules & npm install
  2. Generating bundle:

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/
  1. cd android & ./gradlew assembleRelease

app/build.gradle:

project.ext.react = [
    entryFile: "index.js",
    bundleInDebug: true,
    bundleInRelease: true,
]

apply from: "../../node_modules/react-native/react.gradle"

....

It seems bundleInRelease option is not working properly. However ./gradlew assembleDebug works perfect! Please help!

Upvotes: 1

Views: 4864

Answers (1)

Bakhrom Achilov
Bakhrom Achilov

Reputation: 157

Solved!
I used 'react-native-bitcoinjs-lib' library and the thing is the library was not fully configured. By documentation, for generating release APK, additionally, I had to create file in project named metro.config.js. And wrote following code in it:

module.exports = {
    transformer: {
      minifierConfig: {
        mangle: {
          keep_fnames: true
        }
      }
    }
  }

Now, everything works fine.

Upvotes: 2

Related Questions