Search code examples
javascriptreactjsreact-nativereact-reduxredux-saga

while i try to run react native in android emulator. I get Error type 3. Error: Activity class {com.eg/com.eg.MainActivity} does not exist


BUILD SUCCESSFUL in 10s

154 actionable tasks: 2 executed, 152 up-to-date

info Connecting to the development server...

info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.baqala/.MainActivity }

Error type 3
Error: Activity class {com.baqala/com.baqala.MainActivity} does not exist.

Solution

  • You may be getting this error if you are using product flavours or variants with applicationIdSuffix "<YOUR SUFFIX>"

    My project has multiple build types and product flavours where each flavour specifies applicationIdSuffix in app/build.gradle. When you run react-native run-android --variant=<VARIANT> it will build but fail to open on the emulator. A solution is to add --appIdSuffix '<YOUR SUFFIX>' to your run command

    For example:

    react-native run-android --variant=stagingDebug --appIdSuffix 'staging'
    

    React Native CLI will hopefully fix this in the future.