MainActivity.java and MainApplication.java errors
See original GitHub issueThis 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:
- Deleted my
MainApplication.java
file instead of just changing the package name. - In
MainActivity.java
, it didn’t change the return value ofgetMainComponentName()
causing app to crash on launch on android becauseAppRegistry.registerComponent()
takes the name fromapp.json
which IS updated but this value is not.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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)
This thing still happening today.
To solve this I copied, as explained other comments, previous
MainJavaActivity.java
andMainApplication.java
and changed the package declaration with the folder destinationcom.newName.nextNewName
, and the return ofgetMainComponentName()
fromMainActivity
with the name displayed (name key) onapp.json
.