8

I try to run application on android emulator but it failed. I run react-native run-android, BUILD is SUCCESSFUL but I get error type 3 and I don't see that it installed on emulator.

This part of what I get when I run "react-native run-android" in cmd:

Installed on 1 device. BUILD SUCCESSFUL Total time: 2 mins 24.714 secs Starting the app on ***** (...\Android\sdk/platform-tools/adb -s **** shell am start -n app/.MainActivity)... Starting: Intent { cmp=app/.MainActivity } Error type 3 Error: Activity class {app/app.MainActivity} does not exist. 
6
  • Which version of react-native are you using ? Did it occur after creating a new project or after upgrading react-native for an existing project ? Commented Aug 29, 2016 at 8:53
  • react-native version: 0.30.0, it is existing project, it was after updating project. Commented Aug 29, 2016 at 9:29
  • After shutdown the computer (windows 10), and open again,running again "react-native run-android" the application installed on emulator but still get this error "Error type 3 Error: Activity class {app/app.MainActivity} does not exist." I just opened application on emulator. Commented Aug 29, 2016 at 9:35
  • 2
    Are you sure there are both the files : MainActivity.java & MainApplication.java inside android/app/src/main/java/com/appname ? Can you please provide their code? Commented Aug 29, 2016 at 9:38
  • Yes, MainActivity.java & MainApplication.java inside android/app/src/main/java/com/appname/app Commented Aug 29, 2016 at 9:41

3 Answers 3

1

Step 1 : Check whether the following files have the same package name say "com.companyName.appName":

1. package (usually line 2) in /android/app/src/main/AndroidManifest.xml 2. applicationId (usually line 90) in defaultConfig section of /android/app/build.gradle 3. Line 1 of /android/app/src/main/java/com/paysack/MainApplication.java 4. Line 1 of /android/app/src/main/java/com/paysack/MainActivity.java 

Step 2 :

react-native run-android 
Sign up to request clarification or add additional context in comments.

Comments

0

I spent hours on this and in the end I ended up replacing the package name. The original name contained 2 dots. E.g. com.abc.test Which I renamed to be com.abctest Also keep in mind to update the folder name in Android (android/app/src/main/java/com).

I also tried react-native init myProject --package "com.abctest" but seems like in recent versions of react native this no longer works. I also tried using npm instead of yarn and I also tried to remove node-modules and caches but non of it worked.

Potentially you might also need to run watchman watch-del-all rm -rf node_modules && npm install afterwards

I had this project working just fine a few weeks ago, but seems like something has changed somewhere and the . is no longer parsed correctly.

Comments

0

shut down the emulator and start again then uninstalling the app from emulator solved my problem, if not then you may need to restart your computer-good luck

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.