Create-react-native-app: Error staring Android emulator

Created on 22 Mar 2017  路  16Comments  路  Source: expo/create-react-native-app

Please make our job easier by filling this template out to completion. If you're requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.

Description

yarn run android failed with below error message:

Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://192.168.1.10:19000 flg=0x10000000 }

(node:572) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null

Expected Behavior

What action did you perform?

  1. Create a sample project using create-react-native-app command
  2. open the android emulator (tried with Android Studio and Genymotion, both failed)
  3. run yarn run android in the project folder

and what did you expect to happen?

I expect the the project can be loaded by simulator.

Observed Behavior

What actually happened when you performed the above actions?

I got below errors messages:

If there's an error message, please paste the full terminal output and error message in this code block:

To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app, under the '+' menu.
Or enter this address in the Expo app's search bar:

  exp://192.168.1.10:19000

Your phone will need to be on the same local network as this computer.

For links to install the Expo app, please visit https://expo.io.

Logs from serving your app will appear here. Press Ctrl+C at any time to stop.

Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://192.168.1.10:19000 flg=0x10000000 }

(node:572) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts:

[email protected] C:\Users\x\trunk\rn_android
-- [email protected]

[email protected] C:\Users\x\trunk\rn_android
-- [email protected]

  • node -v:
    v6.9.4
  • npm -v:
    4.1.1
  • yarn -v:
    yarn install v0.21.3

Also specify:

  1. Operating system: Windows Home
  2. Phone/emulator/simulator & version: Android Studio 2.2.3

Reproducible Demo

If you're able, please provide a minimized reproducible demonstration of the problem you're reporting.

Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.

Most helpful comment

Hi @brentvatne, as I already answer you in expo.io forums; after I delete ~/.expo/android-apk-cache folder and re-run "yarn run android" command, expo installed to Android Emulator.

Thank You!

All 16 comments

Thanks for the report! I added some more Android instructions here: https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#npm-run-android

Can you try the steps listed and let me know if that resolves your problem?

I followed your instructions, but I am still getting the same error

Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://192.168.1.10:19000 flg=0x10000000 }

Do you see the Expo app installed on your simulator @xingjianpan?

@jesseruder Ah, I see! No, I don't have Expo App installed on my simulator.
I have an iPhone which I can use Expo App to check my project. I thought yarn run android is similar to react-native run-android which actually installs my project as a standalone app on the emulator.
If it also use Expo App, then I can just use my phone instead.

Maybe it's helpful to add this point in the doc? Since Expo App is not installed by default in the simulator.

yarn run android should install the Expo App on your simulator automatically. But you're saying that after you run that command the Expo App still isn't installed?

@jesseruder , no, Expo App is not installed. I watched the emulator closely but nothing happened.

@xingjianpan you can get the apk from here: https://d1ahtucjixef4r.cloudfront.net/Exponent-1.14.0.apk and then install it manually.

@jesseruder Issue solved after installing the apk. Many thanks!

Hi @jesseruder, this is old issue but apk file in link is old. Do you know where I can download newer apk file of Expo?

@0lide - you can find the latest versions here: https://expo.io/--/api/v2/versions androidUrl and iosUrl

Hi @brentvatne, as I already answer you in expo.io forums; after I delete ~/.expo/android-apk-cache folder and re-run "yarn run android" command, expo installed to Android Emulator.

Thank You!

I had the same problem, but downloading the Expo apk did not solve it for me. The solution was to add "adb" to my PATH, start the Android AVD manually, and restart Expo. Then, running my project on Android automatically detected the AVD, installed the Expo app, and displayed my project.

@0lide Thanks a lot. Instead of installing expo manually, I deleted ~/.expo/android-apk-cache as you commented and it worked.

Muchas gracias, ten铆a el mismo error en GNU/Linux (Mint 18.2 Sonya) y se soluciono instalando manualmente expo.io.

thanks @0lide ! your suggestion worked for me

Downloading the Expo adk worked for me, thanks! This way my phone screen won't get burnt out...

Was this page helpful?
0 / 5 - 0 ratings