Real Android on a specific device

Can I use the command run-androidfor only one specific device?

For example, if I have three devices (or emulators), and I want to use run-androidonly one of them?

Maybe something like adb install -s DEVICE_NUMBER?

Thanks in advance

+4
source share
3 answers

When developing @alexander's answer, you can use the following workflow:

cd android
./gradlew assembleDebug # assembleRelease for release builds
adb install -s <yourdevice> app/build/outputs/apk/yourapk.apk # You can check the identifier for your device with adb devices
adb reverse tcp:8081 tcp:8081 Will forward the phone 8081 port to the computer 8081, where the packager listens. If you are deploying over Wi-Fi, have a look at: https://facebook.imtqy.com/react-native/docs/running-on-device-android.html#configure-your-app-to-connect-to-the-local-dev-server-via-wi-fi

On another screen, run:

npm start # Will run the packager

If you really need it, you can wrap the first fragment in a script that you can parameterize with your phone id.

+1
source

run-android,

-, :

./packager/packager.sh

APK . APK .

, : -)

+1

Maybe we can’t choose which Android device is connected to run.

Read on the official website with reviews:

You must have only one device connected at a time.

0
source

Source: https://habr.com/ru/post/1661490/


All Articles