Issue I Faced
I was trying to run my React Native project with product flavors.
When I executed:
npm run android:dev
- The build succeeded.
- The APK was not installing properly on my device.
- After a partial install, launching the app gave:
Error type 3
Error: Activity class {<applicationId>/<mainActivity>} does not exist.
So the app either didn’t install fully or couldn’t launch.
Root Cause
The issue happened because a previous version of the app was already installed on the device. Android couldn’t overwrite the old APK correctly, which led to installation issues and Error type 3.
How I Solved It
- Uninstall the old app completely:
adb uninstall <applicationId>.develop
- Clean the build:
./gradlew clean
- Reinstall the APK:
npm run android:dev
After this, the app installed correctly and launched successfully.
Tip for Others
- If you switch flavors (
dev,staging,prod), uninstall the previous variant first. - You can combine uninstall + clean + run into a single command:
adb uninstall <applicationId> && ./gradlew clean && npm run android:dev