"You need to have MainApplication in your project" after ejecting

Hello,

I am currently developing a react-native app using Expo but I now needed to eject Expo as I need to use non-compatible features (in-app-purchases).
I ejected Expo using expo eject and selected the “Bare Workflow” as instructed by the docs. I then run yarn android to start the application, the Metro window opens and gradle begins its progress but after a while I get the following error:

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\...\node_modules\react-native-unimodules\gradle.groovy' line: 81

* What went wrong:
A problem occurred evaluating project ':app'.
> You need to have MainApplication in your project

Looking at the file that is throwing this error (Source) looks like MainApplication.java is empty? Looking at ./android/app/src/main/java/com/NAME/MainApplication.java shows that it has contents.

What is the problem?
I tried downgrading react-native to 0.58. My application’s id is “app.NAME” so I thought I may have to simply rename the folder to main/java/app/NAME/ and simply renamed the folder but that didn’t help eather.

I tried downgrading react-native to 0.58. My application’s id is “app.NAME” so I thought I may have to simply rename the folder to main/java/app/NAME/ and simply renamed the folder but that didn’t help eather.

what did you answer for the “What should your Android Studio and Xcode projects be called?” eject step?

same problem here, what was your solution?

In my case, I debug the gradle.groovy a

def generateBasePackageList(List unimodules) {
def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), ‘/MainApplication.java’, ‘’)
def findMainKtApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '
/MainApplication.kt’, ‘’)

There were two MainApplication.java found, one under java/com/xx.xx, the other under java/host/exp/exponent/generated/

I renamed the one under this generated folder, then the script can go through this error, still hasn’t successfully running yet.