react-native-unimodules icon indicating copy to clipboard operation
react-native-unimodules copied to clipboard

Could not find MainApplication.java

Open sinisa-nimcevic opened this issue 3 years ago • 3 comments

On line 77 of gradle.groovy, the findMainJavaApp def will throw an error if you have a more complex application structure.

Right now I'm using the following patch on the node modules file post installation, but this is interfering with my deployment process so I would like to see this fixed soon.

-  def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/MainApplication.java', '')
+  def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/pierre/MainApplication.java', '')

Thanks.

sinisa-nimcevic avatar Jul 28 '20 12:07 sinisa-nimcevic

Same problem.

When we run react-native run-android --variant=appDevDebug to install app with specified variant, unimodule will throw an exception You need to have MainApplication in your project

tourze avatar Mar 14 '21 11:03 tourze

In my case, we use productFlavor to extract multi apk. node_modules/react-native-unimodules/gradle.groovy will count **/MainApplication.java, and failed. I think it is better to change:

  def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/MainApplication.java', '')
  def findMainKtApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/MainApplication.kt', '')

to:

  def findMainJavaApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/main/**/MainApplication.java', '')
  def findMainKtApp = new FileNameFinder().getFileNames(rootProject.getProjectDir().getPath(), '**/main/**/MainApplication.kt', '')

tourze avatar Mar 16 '21 15:03 tourze

Has anyone had eyes on this? Been open for a while without any attention or updates. Unimodules does not appear to support project structures that are using variants. I've got main, debug, and beta with respective MainApplication.java for each–none of them are successfully found when running the app.

Anything I can provide to help?

joeyfigaro avatar Oct 12 '21 21:10 joeyfigaro