Cannot run application after eject
See original GitHub issueDescription
After running npm run eject
de android project cannot resolve ReactApplication and ReactNativeHost and it does not compile.
Expected Behavior
I can compile the android project generated by npm run eject
and execute it in the androi emulator
Observed Behavior
The project has some errors in the imports, like ReactApplication or ReactNativeHost. The MainActivity does not implement the method getUseDeveloperSupport()
that is required as it extends ReactActivity
Environment
Please run these commands in the project folder and fill in their results:
npm ls react-native-scripts
: emptynpm ls react-native
: react-native@0.55.4npm ls expo
: emptynode -v
: v8.11.3npm -v
: 5.6.0yarn --version
: 1.9.4watchman version
: The term ‘watchman’ is not recognized as the name of a cmdlet
Also specify:
- Operating system: Microsoft Windows 10 Enterprise
- Phone/emulator/simulator & version: Android emulator, API 27, Android 8.1 (Google APIs)
Reproducible Demo
$ npm install -g expo-cli
$ expo init my-app
$ cd my-app/
$ npm run eject
Then open Android Studio and try to compile the Android project generated after npm eject
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:5
Top Results From Across the Web
If you can't eject a disk on Mac because an app is using it
Quit the apps that are using the disk, then try to eject it again. If you can't quit an app, close the documents...
Read more >Cannot run React Native app after ejecting Expo
I had a similar problem after ejecting but mine was 'Chalk was missing'. So I solved it by running the following commands:
Read more >Cannot run ios after ejecting a bare expo project
Hi,. I created a bare expo project and ejected immediately after that. Then I run npm run ios but I get this error...
Read more >Cannot Eject External Drive After Installing Microsoft Store App
Close any programs or windows that might be using the device and then try again.' If I remove the external drive without ejecting...
Read more >((SOLVED)) "app is damaged and can't be opened ... - YouTube
" App is damaged and can't be opened. you should eject the disk image",, ... Cannot open application please do not forget to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ran into this problem as well. It took a few days of searching to realize that there are several issues after ejecting. Here’s the things that worked for me.
One issue can be with react-native 0.56.* in the project after ejecting. It looks like you have
0.54.0
which works fine but if you don’t then consider downgrading for now. See this issue here https://github.com/react-community/create-react-native-app/issues/401After ejecting in
package.json
react-native is listed as this"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz"
which doesn’t seem to work.To downgrade to react-native@0.55.4
You can do this by removing your node_modules, changing your
package.json
to usereact-native@0.55.4
and then reinstalling node_modules with
npm install
oryarn install
if using yarn.The second issue is that you’ll need to check in your
android/build.gradle
and make sure that Google’s Maven repositorygoogle()
is included in bothbuildscript {}
andallprojects{}
. By default it’s missing after eject. This is only the case if using a Gradle version > 4.1 though.Something like this (although yours might look slightly different)
In addition it seems that
index.js
,index.android.js
andindex.ios.js
are not created when ejecting anymore. So check for those and if they aren’t there at least createindex.js
in the project root and add the following to it to get started.I’ve just gone through these steps again on a new app and confirmed that they fix the issues.
This issue still exists!