thecodingmachine/react-native-boilerplate

App fails to start after renaming

Zefau opened this issue ยท 6 comments

Zefau commented

Renaming the project updates the following files accordingly:

  • App/index.js
  • App/app.json
  • /android/settings.gradle

But the file MainActivity.java gets deleted once renaming the project. Thus /android/app/src/main/java/com/[yourprojectname]/MainActivity.java does not exist.

Manually copying and modifying the files solves the problem.
Thus, adaption of yarn run rename is required.

Originally posted by @Zefau in #22 (comment)

+1 @Zefau thanks for spotting and figuring this out!

Hey @Zefau and @intelligentspark !

It seems that the new version installed do not provide this error anymore.

I merged this PR #44 adding a link to this issue.

Thank you guys

I got this error. I added MainApplication.java and MainActivity.java from the repo to the new folder and now I'm getting this error:

> Task :app:compileDebugJavaWithJavac FAILED
M:\Google Drive\SC\frontend\android\app\src\main\java\com\sc\MainApplication.java:20: error: cannot find symbol
      return BuildConfig.DEBUG;
             ^
  symbol: variable BuildConfig

Hello @joshuakoh7 !

Does the path of the MainActivity.java file is the same as your app package name ?

For example, in the boilerplate, the package name is com.boilerplate (you can found it in android/app/src/main/AndroidManifest.xml or android/app/build.gradle)
So, the path is android/app/src/main/java/com/boilerplate/MainApplication.java

Thanks

I fixed it. I had unknowingly capitalised the app name in AndroidManifest.xml so it couldn't find the right app.

I can see this issue is closed but I am still getting this issue.

Btw MainApplication.java is also getting deleted.