Robin
Robin

Reputation: 5486

Android studio's adb is ignored for running the android emulator

I have a react native project using expo. I can run the IOS simulator using, which works fine

npm run ios

I have also installed Android Studio and it has the required sdks and other stuff as required in the react native documentation. Also, I have installed Genymotion for the android emulator and changed the adb section to custom directory to the Android studio's director where the sdk is, which is located in (/Users/robin/library/android/sdk).

However, I can't run the android simulator. If I run this command:

npm run android

I get an error:

Error running adb: No Android device found. Please connect a device and follow the instructions here to enable USB debugging: https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.

So I checked where the adb is running from:

$ which adb
/usr/local/bin/adb

However, the adb of Android studio is located in

/Users/robin/library/android/sdk/platform-tools/adb

I think Android studio's adb is not running for the emulator. What am I doing wrong here?

Upvotes: 1

Views: 3546

Answers (1)

Brent Barbata
Brent Barbata

Reputation: 3641

I don't want to admit how many hours I spent on this, but it looks like you have everything configured correctly. (For anyone else confused about the config options, see the Expo documentation for Genymotion.)

When using yarn start ios, an iOS simulator is automatically started for you and your app will run. However, when using yarn start android, a Genymotion virtual device is not automatically started for you. So, open Genymotion, and make sure you have a virtual device. If you don't have any yet, hit the + icon and add one. Then start it. Now go back to your terminal and run yarn start android.

I know this question is almost three weeks old so hopefully you were able to sort everything out, but I thought I'd chime in just in case anyone else runs into this problem.

Upvotes: 3

Related Questions