question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Activity class MainActivity does not exist

See original GitHub issue

I’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. screen shot 2018-01-03 at 10 06 51 am

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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

9reactions
dccmmtopcommented, Nov 3, 2018

I am back , I resolve the problem ,hahaha.

adb uninstall “package name”

9reactions
HHuiHaocommented, Jul 3, 2018

ApplicationId is consistent with the package name, or delete it.

android/app/build.gradle
defaultConfig {
      applicationId "xxx" 
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error type 3 Error: Activity class {} does not exist - Stack Overflow
Try changing the name of the Activity in your AndroidManifest.xml file. · This happened to e too and I had to go to...
Read more >
Different Ways to Fix "Error type 3 Error: Activity class {} does ...
“Error type 3: Activity class {} does not exist” in the Android Studio. · six methods · Step 1 · to Build >...
Read more >
How to Solve Android Studio Error Main Activity ... - YouTube
This video tutorial teaches you how to solve Android Studio Error, MainActivity Class does not Exist. This problem stops you from deploying ...
Read more >
Android : Error type 3. Activity class {com.awesome_project ...
Android : Error type 3. Activity class {com.awesome_project/ com.awesome_project. MainActivity } does not exist in react native (Android ...
Read more >
ReactNative:Error: Activity class {.MainActivity} does not exist.
The following is that error messages filtered by app name by using AVD Manager of Android SDK Tools. The part of com.sampleproject contains ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found