I'm aware there's a plethora of questions/answers regarding this issue. However, I have spent the past few days trying a number of solutions I've found on SO and none have worked thus far.
My error:
BUILD SUCCESSFUL in 52s 372 actionable tasks: 352 executed, 20 up-to-date info Running C:\Users\User\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081 info Starting the app on emulator-5554 (C:\Users\User\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 shell am start -n mypackage/mypackage.MainActivity)... Starting: Intent { cmp=mypackage/.MainActivity } Error type 3 Error: Activity class {mypackage/mypackage.MainActivity} does not exist. Here is a list of all the things I've attempted to do based on other SO posts:
Attempts
Running
adb kill-server,adb start-server, thenreact-native run-androidRunning
adb reverse tcp:8081 tcp:8081, thenreact-native run-android(a senior dev I used to work with told me the issue might be related to this a long time ago, but I cannot get in touch with him)Uninstalling the App from the Emulator, as well as my physical device
Build -> Clean ProjectFiles -> Invalidate Cache / RestartFiles -> Sync Project with Gradle FilesBuild -> Rebuild ProjectDeleted gradle cache files in
/project/android/.gradle/5.1.1AndroidManifest.xml-><activity android:name=".MainActivity"to<activity android:name="packagename.MainActivity"android/app/build.gradleto view buildTypes
debug { applicationIdSuffix ".debug" } stagingRelease { applicationIdSuffix ".staging" } release { } Ran react-native run-android --variant=[debug] --appIdSuffix '[.debug]'
&&
Ran react-native run-android --variant=[stagingRelease] --appIdSuffix '[.staging]'
(these came with different errors)
- Make sure android/app/build.gradle
defaultConfig { applicationId "WHATEVER_THIS_IS" } needs to match android/app/src/main/java/com/app_name/MainActivity.java line one:
package WHATEVER_THIS_IS; needs to match android/app/src/main/java/com/app_name/MainApplication.java line one:
package WHATEVER_THIS_IS; needs to match android/app/src/main/AndroidManifest.xml line one:
package="WHATEVER_THIS_IS"> - Went to
android/app/build.gradleand changed:
splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } to
splits { abi { reset() enable true universalApk true // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } - Went to
C:/Users/User/.gradleto delete thecache. Was unable to delete everything, as I kept getting alerts that many of the files/folders inside are currently "open in another program" (untrue as far as I can tell)
Nothing worked.
Posts I followed for solutions
Error type 3 Error: Activity class {} does not exist


