Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve 'You need to have MainApplication in your project' in React native run-android

I ejected from expo, and trying react-native run-android, I'm getting this error;

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\simil\OneDrive\Documents\Codes\react-native\expo\doc\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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

This is my MainActivity path

MyApp\android\app\src\main\java\com\com.example.eg\MainActivity.java

like image 813
Similoluwa Odeyemi Avatar asked Feb 16 '20 16:02

Similoluwa Odeyemi


Video Answer


1 Answers

I faced this problem on my project too, reason was, I ejected from expo, reversed the eject and changed the bundleid. After that I ejected again.

This created 2 different MainApplication.java under app/src/main/java.

To fix it I removed the one with the old bundleid folder.

like image 84
Burak Tokak Avatar answered Oct 16 '22 04:10

Burak Tokak