Android app not running anymore after performing Expo Eject "error: package does not exist" and "error: cannot find symbol"

821 views Asked by At

CONTEXT

This is the first React Native app I have made and we started with Expo not knowing which functionalities we were going to use. Turns out we had to do some platform-specific configuration, so we had to eject Expo. Ever since we have not been able to get Android running and thus also not been able to do builds for Google Play.

I have scoured the internet for solutions and feel like I've tried everything but can not get it to work. I am a rookie at this as I have only used React Native with the Expo Managed workflow and feel lost now.

ENVIRONMENT

Node 16.15.0 Npm 8.5.5 React 17.0.2 React Native 0.68.2 Expo SDK 45.0.0 Android Studio: SDK 33 SDK Tools 33

PROBLEM

When running npx react-native run-android I get tons of errors that either say error: package android.xxx.yyy not found or error: cannot find symbol I am in no case experienced with Android configuration and I assume I did some damage during the ejection of Expo but I have not been able to find a solution anywhere online. If anyone knows any solution I am happy to try it, please let me know if I should provide more information!

FULL OUTPUT

As StackOverflow won't let me post the full error, I've uploaded it on pastebin: https://pastebin.com/cJ2HJDpw

Here are two examples but there's plenty more:

/Users/shendric/Desktop/Palau/PalauApp/node_modules/expo-modules-core/android/src/main/java/expo/modules/apploader/AppLoaderProvider.java:4: error: package android.content.pm does not exist
import android.content.pm.PackageManager;
/Users/shendric/Desktop/Palau/PalauApp/node_modules/expo-modules-core/android/src/main/java/expo/modules/core/interfaces/Package.java:13: error: cannot find symbol
  default List<? extends InternalModule> createInternalModules(Context context) {
                                                               ^
  symbol:   class Context
  location: interface Package
2

There are 2 answers

0
Simon Hendrickx On BEST ANSWER

For anyone coming across this issue, in the end I had to re-eject expo for android only and reapply the config I had done previously... This was the only way to get it to work again, sadly.

2
Ahmed Azeez On

Use expo r in the terminal or expo start because npx react-native run-android is for using React Native CLI.