[Nix-dev] Android SDK

Marc Weber marco-oweber at gmx.de
Thu Aug 30 12:06:53 CEST 2012


Hi Alexander Foremny,

I've tried so in the past too. This helped me:


  AndroidSDKExecutablePatcher = pkgs.runCommand "android-sdk-executable-patcher" {} ''
  ensureDir $out/bin
  t=$out/bin/$name
  libPath=${pkgs.ncurses}/lib:${gcc.gcc}/lib
  cat >> $t << EOF
  !/bin/sh
  find \$1 \\( \\
      \\( -type f -a -name "*.so*" \\) -o \\
      \\( -type f -a -perm +0100 \\) \\
      \\) -print -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" --set-rpath $libPath {} \\;

  EOF
  chmod +x $t
  '';

I think I even got the emulator working this way - but it crashed if I
recall correctly.

Packaging android SDK for nix eventually could be done.
The Android SDK way is to use Eclipse GUI to manage the android SDK
installation (which should work if run the script above once in the SDK
checkout).
Because there are many many optional components you can install it may
be best to try to write a nice wrapper or chroot env which makes
everything just work - rather than patching many lines..

Eg compiling the SDK from source would require a lot of work, because it
assumes /bin/* tools exist.

So while I appreciate you spending time on creating nix expression I'd
think twice about which way provides most value causing minimal effort.

Marc Weber


More information about the nix-dev mailing list