built android package failed to launch

Hi guys, I’m new here and here’s to hoping someone is able to answer my question.
I built an apk package with eas build -p android --profile test, the build was successful (but with some kind of error in ‘expo doctor’). App installed successfully on mobile but it fails to open. once clicked, it just opens then immediately closes back.
I’m all new to expo and development in general, please help here.

hello! here’s a guide to help with exactly this! Troubleshooting build errors and crashes - Expo Documentation

i just read your build logs (i work on expo) and saw the doctor warning. you should follow the instructions to find out which package is bringing in those old versions.

I do not understand the errors or instructions in the warnings.
Can you please explain in detail how to fix one and I can follow that prototype to fix others?
I’m working with an already made template and the app has been working fine via expo go (when I publish to default channel and when running via local server)

followed this guide and the links after it, nothing to help solve the issue. :disappointed_relieved:

what do you see when you run npm why expo-modules-autolinking@0.5.5 in your project? what about when you run npm why @expo/prebuild-config@3.1.2?

1 Like

for npm why expo-modules-autolinking@0.5.5

and for npm why @expo/prebuild-config@3.1.2

it looks like you have eas-cli installed to your project dependencies. you should only install it globally.

1 Like

I think I installed it globally, i simply run “npm install -g eas-cli”

If this was wrong. What do I do?
I have a backed up version of the project before installing eas cli with the above command. Should I revert to that and do something different?
Please clarify.

That is the correct way, but it looks like you also installed it like this:

npm install eas-cli

(Note the lack of -g)

Try running npm remove eas-cli and just in case you have that installed locally too, run npm remove expo-cli

After that, try running expo-cli doctor to see if there are still complaints.
If there are, try running expo-cli doctor --fix-dependencies

1 Like

I see,
Thanks for the very clear explanation. :pray:t3:
Will try this steps and get back.

@wodin @notbrent
I have tried the steps wodin gave, but I still get this message when i run expo doctor

if i read the messages correctly, looks like it’s requesting a specific version of expo-modules-autolinking, expo/config-plugins) and expo/prebuild-config), is there a way to install the specific version of this packages?
tried searching online, I only got the command for installing latest updates.
please help here :pray:

Please re-run:

npm why expo-modules-autolinking@0.10.2
npm why @expo/config-plugins@5.0.1
npm why @expo/prebuild-config@5.0.3

Also, please paste the dependencies and devDependencies sections from your package.json file here (as text, please. Not an image.)

Thanks for your reply.
I have changed e.g @expo/prebuild-config": “^5.0.3” to @ expo/prebuild-config": “^5.0.3” (added a space between the @ the words) because the editor thinks I’m trying to mention multiple users and brings an error saying “I can’t mention more than 2 users as a new user” so i added the space to excuse that.

"dependencies": {
    "@expo/prebuild-config": "^5.0.3",
    "@expo/vector-icons": "^13.0.0",
    "@openspacelabs/react-native-zoomable-view": "^2.0.0",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-community/slider": "4.2.1",
    "@react-navigation/bottom-tabs": "^6.0.9",
    "@react-navigation/drawer": "^6.4.1",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5",
    "@react-navigation/stack": "^6.0.11",
    "@stripe/stripe-react-native": "0.6.1",
    "apisauce": "^2.1.5",
    "expo": "^45.0.0",
    "expo-ads-admob": "~13.0.0",
    "expo-apple-authentication": "~4.2.1",
    "expo-auth-session": "~3.6.1",
    "expo-constants": "~13.1.1",
    "expo-facebook": "~12.2.0",
    "expo-firebase-recaptcha": "~2.2.0",
    "expo-google-sign-in": "~10.2.0",
    "expo-image-picker": "~13.1.1",
    "expo-linear-gradient": "~11.3.0",
    "expo-linking": "~3.1.0",
    "expo-localization": "~13.0.0",
    "expo-location": "~14.2.2",
    "expo-notifications": "~0.15.4",
    "expo-random": "~12.2.0",
    "expo-secure-store": "~11.2.0",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.4",
    "firebase": "9.2.0",
    "formik": "^2.2.9",
    "global": "^4.4.0",
    "html-entities": "^2.3.2",
    "lodash": "^4.17.21",
    "lottie-react-native": "5.0.1",
    "mime": "^3.0.0",
    "moment": "^2.29.1",
    "qs": "^6.10.2",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-credit-card-input": "^0.4.1",
    "react-native-draggable-flatlist": "^3.0.4",
    "react-native-geocoding": "^0.5.0",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-maps": "0.30.2",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-progress": "^5.0.0",
    "react-native-read-more-text": "^1.1.2",
    "react-native-reanimated": "~2.8.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-web": "0.17.7",
    "react-native-webview": "11.18.1",
    "react-native-youtube-iframe": "^2.2.1",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "~17.0.21",
    "@types/react-native": "~0.67.6",
    "react-native-svg-transformer": "^1.0.0",
    "typescript": "~4.3.5"
  }

:slight_smile:

Next time you can select the whole chunk of text and then click on the “</>” button in the editor’s toolbar. That basically just adds three backticks above and below the text you selected (so you could just type those yourself.)

Oh, didn’t know (I’m such a newbie)
Waiting for your response as regards the fix please :pray:t3:

I’ve added the backticks to your post and removed the spaces after the “@” signs.

If I install your dependencies in a test app, expo doctor tells me the following. (Your output might be slightly different, depending on exactly which versions of the dependencies you have in your package-lock.json file):

$ expo doctor
Expected package @expo/config-plugins@^4.1.0
Found invalid:
  @expo/config-plugins@5.0.0
  @expo/config-plugins@5.0.1
  (for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@^4.0.0
Found invalid:
  @expo/prebuild-config@5.0.3
  (for more info, run: npm why @expo/prebuild-config)

If I run npm why ... to see what is causing those packages to be installed, I find the following:

$ npm why @expo/config-plugins@5.0.0
@expo/config-plugins@5.0.0
node_modules/@expo/metro-config/node_modules/@expo/config-plugins
  @expo/config-plugins@"~5.0.0" from @expo/config@7.0.0
  node_modules/@expo/metro-config/node_modules/@expo/config
    @expo/config@"7.0.0" from @expo/metro-config@0.3.21
    node_modules/@expo/metro-config
      @expo/metro-config@"~0.3.16" from @expo/cli@0.1.5
      node_modules/@expo/cli
        @expo/cli@"0.1.5" from expo@45.0.6
        node_modules/expo
          expo@"^45.0.0" from the root project
[...]

OK, so @expo/config-plugins@5.0.0 is coming from expo in my case! Let’s look at the others before worrying about trying to fix this.

$ npm why @expo/config-plugins@5.0.1
@expo/config-plugins@5.0.1
node_modules/@expo/prebuild-config/node_modules/@expo/config-plugins
  @expo/config-plugins@"~5.0.1" from @expo/prebuild-config@5.0.3
  node_modules/@expo/prebuild-config
    @expo/prebuild-config@"^5.0.3" from the root project
  @expo/config-plugins@"~5.0.1" from @expo/config@7.0.1
  node_modules/@expo/prebuild-config/node_modules/@expo/config
    @expo/config@"7.0.1" from @expo/prebuild-config@5.0.3
    node_modules/@expo/prebuild-config
      @expo/prebuild-config@"^5.0.3" from the root project

This one is coming from @expo/prebuild-config

$ npm why @expo/prebuild-config@5.0.3
@expo/prebuild-config@5.0.3
node_modules/@expo/prebuild-config
  @expo/prebuild-config@"^5.0.3" from the root project

and @expo/prebuild-config is directly installed in your project.

This should not be there. Please run npm remove @expo/prebuild-config to remove it.
Then try expo doctor --fix-dependencies again.

If it still gives you errors, I suggest you do this:

expo upgrade 45

Then try expo doctor again.

If it still doesn’t work :sweat_smile: Delete your node_modules and package-lock.json (and yarn.lock if it exists) and then run npm install (just npm install. No other arguments) to reinstall your dependencies.

Then with any luck that should get rid of the expo doctor errors.

1 Like

No way!
you are a true gem! @wodin
How do y’all know all this things? guess I have a very long way to go in knowledge.
I removed @expo/prebuild-config as you’ve said and running expo doctor again returns this

Thank you sooo much for your time.
I’m gonna run eas build -p android --profile test again and hopefully my excitement is not punctured and my app opens correctly :sweat_smile:
I will update once I do that. Thank you soo much again.

1 Like

I’ve been at this for a while :slight_smile: