Search code examples
android-studiogradlereact-nativereact-native-cli

Release build crashing after a successful build in android and iOS after changing appName for a react native project


Android release build crashing after changing app_name (strings.xml). App is building and running successfully in DEBUG variant but failing with the below error in release varian both through CLI (react-native run-android --variant release --deviceId XYZZ) and through android-studio.

screenshot of logcat logs

enter image description here.

Steps taken to resolve:

  1. Clear gradle cache.
  2. Remove node modules, yarn lock and reinstall modules
  3. Invalidate cache and restart android studio.
  4. Clear project cache in Android studio.
  5. gradlew clean

Please note the DEBUG build is successfully running.

"react": "16.8.3", "react-native": "0.59.4", gradle-5.4.1, buildToolsVersion = "28.0.3, compileSdkVersion = 28, targetSdkVersion = 28, supportLibVersion = "28.0.0", googlePlayServicesVersion = "11.8.0""

EDIT: AppName in package.json and app.json and getMainComponentName() in MainActivity class all refer to the same name and AppRegistry is using the appName from app.json(project created using react-native init).


Solution

  • Found the issue to be not related to change in appName rather app unable to start because of issue in store.js implementation. const middlewares = [thunk, __DEV__ ? logger : null]; Trying to apply a null middleware is the issue for app crashing on boot. But thanks to the friendly vague message Application is not registered which ruined most of the time.