Error: Activity class MainActivity does not exist
See original GitHub issueI’m integration React Native with an existing android project. When I run the project(react-native-cli run-android --no-packager), there is an error: Activity class MainActivity does not exist. However, my android project should start with an activity named HomeActivity instead of MainActivity. Sorry for my bad English. The error for a rookie is very difficult. Thank you!
Is this a bug report?
(write your answer here) Yes
Have you read the Contributing Guidelines?
(Write your answer here.) Yes
Environment
Environment: OS: macOS High Sierra 10.13.3 Node: 9.3.0 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.51.0 => 0.51.0
Steps to Reproduce
(Write your steps here:)
1.init a react native project with react-native init yourprojectname 2.run npm install 3.go to folder /yourprojectname/android/app/src/main/java/com/yourprojectname/ 4.rename MainActivity.java to HomeActivity.java 5.open HomeActivity.java, change class name from MainActivity to HomeActivity 6.go to folder /yourprojectname/android/app/src/main 7.open AndroidManifest.xml, change activity from MainActivity to HomeActivity 8.run react-native run-android
Expected Behavior
(Write what you thought would happen.) app install to android device
Actual Behavior
(Write what happened. Add screenshots!) an error will jump out error: Activity class MainActivity does not exist.
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.) https://drive.google.com/file/d/1L1mMgb-IV185v52HznFNqLINwvlGIPsf/view?usp=sharing it’s a zip file, please extract it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top GitHub Comments
I am back , I resolve the problem ,hahaha.
adb uninstall “package name”
ApplicationId is consistent with the package name, or delete it.