google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.52k stars 385 forks source link

Installation of apks from aab with --local-testing flag fails when multiple emulators are connected #264

Closed ShashankSR closed 2 years ago

ShashankSR commented 2 years ago

Describe the bug Installing aab with --local-testing on host with multiple devices connected, fails, even when we pass --device-id

Bundletool version(s) affected Version: 1.8.2

Stacktrace

com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Expected to find one connected device, but found 2.
    at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
    at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:49)
    at com.android.tools.build.bundletool.commands.InstallApksCommand.cleanUpEmulatedSplits(InstallApksCommand.java:227)
    at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:221)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:91)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:49)
Caused by: com.android.tools.build.bundletool.model.exceptions.DeviceNotFoundException$TooManyDevicesMatchedException: Unable to find one device matching the given criteria. Matched 2 devices.
    at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:78)
    at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:43)
    ... 4 more

To Reproduce

Expected behavior

Known workaround If you have found a workaround, please specify what it is.

Environment: OS: [e.g. iOS 10.3.3]

Additional context Add any other context about the problem here.

uKetki commented 2 years ago

@keyboardsurfer @wojtek-kalicinski Can you please check the PR? We are blocked on this issue and due to this, we need to keep the internal fork for Bundletool which will involve maintenance costs at our end. Any response will be highly appreciated, Thanks!

plecesne commented 2 years ago

Have you tried the --device-id flag to specify a specific device per its serial name? You can get the serial name with adb devices

ShashankSR commented 2 years ago

Yes , mentioned the same in the issue description. Will highlight it