summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorLuca Favatella <lucafavatella@users.noreply.github.com>2020-03-09 05:35:53 +0000
committerLuca Favatella <lucafavatella@users.noreply.github.com>2020-03-09 15:38:49 +0000
commitc50618898f4981947a7f6c57fb42b410a7dc98ba (patch)
tree2b5dfbb173797ae458d83cf596c2fd46b0f0f183 /pkgs/development/mobile
parent954b406ac2ab7b5308e1022223700706d2597583 (diff)
downloadnixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar.gz
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar.bz2
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar.lz
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar.xz
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.tar.zst
nixpkgs-c50618898f4981947a7f6c57fb42b410a7dc98ba.zip
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
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/androidenv/emulate-app.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkgs/development/mobile/androidenv/emulate-app.nix b/pkgs/development/mobile/androidenv/emulate-app.nix
index fa9a56fadba..6273d75cc38 100644
--- a/pkgs/development/mobile/androidenv/emulate-app.nix
+++ b/pkgs/development/mobile/androidenv/emulate-app.nix
@@ -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