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.

MainActivity.java and MainApplication.java errors

See original GitHub issue

This issue is related to #66

I am creating a separate issue because I noticed some additional issues:

When I ran the command

react-native-rename "TravelApp" -b com.travelcompany.app

The following issues occurred:

  1. Deleted my MainApplication.java file instead of just changing the package name.
  2. In MainActivity.java, it didn’t change the return value of getMainComponentName() causing app to crash on launch on android because AppRegistry.registerComponent() takes the name from app.json which IS updated but this value is not.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

9reactions
priyangamanicommented, Mar 5, 2019

1.Try to copy the previous Mainapplication.java file and MainActivity.Java file 2.And Try to rename the package name inside Mainapplication.java file from (old package name) to com.demo (new package name) and similar to MainActivity.Java 3.getMainComponentName() change the return value to “Demo” (your App Name) image

0reactions
josegovalcommented, May 19, 2021

This thing still happening today.

To solve this I copied, as explained other comments, previous MainJavaActivity.java and MainApplication.java and changed the package declaration with the folder destination com.newName.nextNewName, and the return of getMainComponentName() from MainActivity with the name displayed (name key) on app.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Android Build Error MainActivity.java:29
Seems like you have updated your package name in all files but failed to change the name of folder which we will same...
Read more >
React-Native-FS Compiling Error - Super User
if you are using RN +0.40, follow step below instead docs step "register module (in MainActivity.java)" go in MainApplication.java
Read more >
Hippo - Execution failed for task - Higgs - SOBotics
java :5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity public class MainActivity extends ReactActivity ...
Read more >
Android Native Modules
Android studio is an IDE built for Android development and using it will help you resolve minor issues like code syntax errors quickly....
Read more >
:app:compiledebugjavawithjavac react native - You.com
public String getJSMainModuleName() { ^ MainApplication.java:73: error: class, ... F:\React2\appwn\android\app\src\main\java\com\appwn\MainActivity.java:5: ...
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 Reddit Thread

No results found

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