androidenv/emulate-app: fix image id for recent device manager
Symptom:
```
Available Android targets:
----------
id: 1 or "android-28"
Name: Android 9
Type: Platform
API level: 28
Revision: 6
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : google_ndk_playstore/x86
...
Error: Invalid --tag google_apis_playstore for the selected target.
```
For creation of AVD, switch from `android` to `avdmanager` as the
latter seems enabling selecting the image with less friction (and is
better documented as not deprecated). This requires using recent
tools - from https://developer.android.com/studio/releases/sdk-tools :
> SDK Tools, Revision 25.3.0 (March 2017)
> ...
> `android avd` command-line functionality replaced with new
> `avdmanager` tool.
For listing of targets, switch from `android` to `avdmanager` as the
`android` command invocation fails in recent tools. Symptom (not
missing `s` as backward incompatibility):
```
Invalid or unsupported command "list targets"
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
```
References:
- https://developer.android.com/studio/tools/help/android
- https://developer.android.com/studio/command-line/avdmanager
This commit is contained in:
parent
954b406ac2
commit
c50618898f
@ -8,6 +8,7 @@
|
||||
|
||||
let
|
||||
sdkArgs = {
|
||||
toolsVersion = "26.1.1";
|
||||
platformVersions = [ platformVersion ];
|
||||
includeEmulator = true;
|
||||
includeSystemImages = true;
|
||||
@ -67,12 +68,12 @@ stdenv.mkDerivation {
|
||||
export ANDROID_SERIAL="emulator-$port"
|
||||
|
||||
# Create a virtual android device for testing if it does not exists
|
||||
${sdk}/libexec/android-sdk/tools/android list targets
|
||||
${sdk}/libexec/android-sdk/tools/bin/avdmanager list target
|
||||
|
||||
if [ "$(${sdk}/libexec/android-sdk/tools/android list avd | grep 'Name: device')" = "" ]
|
||||
then
|
||||
# Create a virtual android device
|
||||
yes "" | ${sdk}/libexec/android-sdk/tools/android create avd -n device -t 1 --abi ${systemImageType}/${abiVersion} $NIX_ANDROID_AVD_FLAGS
|
||||
yes "" | ${sdk}/libexec/android-sdk/tools/bin/avdmanager create avd -n device -k "system-images;android-${platformVersion};${systemImageType};${abiVersion}" $NIX_ANDROID_AVD_FLAGS
|
||||
|
||||
${lib.optionalString enableGPU ''
|
||||
# Enable GPU acceleration
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user