Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native app won't start when using applicationIdSuffix

I am using [email protected] and part of the setup includes specifying applicationIdSuffix.

I've set this up on a previous app in the past with no issues (React Native 0.37). I've encountered this error twice now with this project (React Native 0.40). The first time I rebuilt my entire project and it went away. It started happening again for no apparent reason so I cloned the last stable version of my project in a fresh directory, and got the same error.

The error occurs when using react-native run-android. The error happens after a successful build:

Starting: Intent { cmp=com.packagename/.MainActivity }
Error type 3
Error: Activity class {com.packagename/com.packagename.MainActivity} does not exist.

The error goes away if I remove applicationIdSuffix ".debug" from app/build.gradle and the app starts on my phone without issue.

My phone is a Nexus 6P with Android 7.0. I've only tried on a physical device since I don't have simulators set up.

I've triple checked everything against to my other project and I don't believe it's a configuration issue.

like image 640
Jameal G Avatar asked Jan 20 '17 20:01

Jameal G


1 Answers

What Im using for React Native 0.60+ with multiple build configurations

In my app/bundle.gradle file I have the following configuration

productFlavors {
   dev {
       applicationId "com.my.app.development"
       dimension "standard"
   }
   production {
       applicationId "com.my.app"
       dimension "standard"
   }
}

buildTypes {
   release {
        // your release build values
   }
   debug {
       // your debug build values
       debuggable true
   }
}

For a standard debug build

react-native run-android --variant devDebug --appIdSuffix \"development\"

For a Staging build (dev variables, but built for release)

react-native run-android --variant devRelease --appIdSuffix \"development\"

For a Release build

react-native run-android --variant productionRelease


this worked for me on react-native 0.50.3

react-native run-android --appIdSuffix "debug"

like image 144
Simon Avatar answered Oct 06 '22 01:10

Simon