Kevin
Kevin

Reputation: 41

React-native Android release build broken (UI navigation breaks without error) - works correctly in debug build

I have a react-native app which works correctly in Android debug builds but doesn't work in Android the release builds.

The app is using redux, axios and react-navigation:

All of this works fine in debug mode both on a real Android device and on the emulator (react-native run-android). 

When I run a release build (react-native run-android --variant=release), it compiles and installs and loads the home screen as before but when I press the search button it doesn't navigate to the search results. There is no error.

Things I have tested:

How do I work out what is causing the failure?

Upvotes: 1

Views: 907

Answers (1)

Kevin
Kevin

Reputation: 41

It turns out the minification of the Javascript bundle was breaking my code.

No error was being output because the exception was thrown in an async function.

I was able to disable minification of the bundle by passing "--minify=false" to the packager via app/build.gradle:

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  
    extraPackagerArgs: [ '--minify=false' ]
]

Upvotes: 1

Related Questions