EDIT!! - > I’ve found the source to this issue, so if mods want to archive this/would like me to remove it, feel free. Leaving it here incase anyone wants a quick laugh at my pain
Hey everyone!
In the process of getting set up with EAS. I’ve got my iOS app building successfully, but I’m running into an issue while building Android:
…
[stderr] A problem occurred evaluating project ':app'.
[stderr] > You need to have MainApplication in your project
…
I’ve seen this issue before, but only locally (which I fixed a month or so ago). Most of what you’ll find when googling is either that people actually DON’T have a MainApllication.java file (was my issue before lol), or they have multiple. Neither of these are the case for me locally. Running a quick `find . -name “MainApplication*” shows that my MainApplication.java is the only one.
This error is stemming from the build.groovy file inside of react-native-unimodules. The actual piece that breaks is:
def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/MainApplication.java', '')
def findMainKtApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/MainApplication.kt', '')
if (findMainJavaApp.size() != 1 && findMainKtApp.size() != 1) {
throw new GradleException("You need to have MainApplication in your project")
}
So my suspicion is that either somehow, inside of the eas build, its generating an extra MainApplication.java, OR rootProject.getProjectDir().getPath()
isnt giving the correct path in the build environment. Because I’m not building this locally, I’m unable to really debug this any further…
Some other potentially useful notes:
- Able to run gradlew commands locally, i.e. gradlew clean, without issue locally
- App builds locally on an emulator without issue
- Have been able to create a production build with my own keystore etc successfully locally, but am now letting expo handle my credentials
- I’m on SDK ~40.0.0
- I’ve updated my eas-cli to latest
- My eas.json file currently has the default configuration
- Im using the bare workflow, previously manage, ejected a month or two ago
Anyone have any ideas here?? Think I’ve just about run out of things to try haha. Any help is appreciated!!