Using Nix for development, building, and testing android project

Is there any good documentation or tutorial or maybe snippet that i can take a look for android specific project?

I have android project that I want to use nix as my cd/ci to help me maintain it. I have seen several repo but I want to know if there is anyone here has experienced with large android project?

1 Like

Sander made a tutorial some time ago, explaining how to build Android apps in Nix:

1 Like

I noticed GitHub - uniphil/nix-for-devs: nix-shell recipes altho I haven’t tried it.

1 Like

You should ask Sander van der Burg. He has done a lot with Android and Nix. See this talk he gave at the Amsterdam Nix Meetup:

1 Like

thank you to all of you. I am reading it right now.

Here is a small nix file I use for developing a react-native project:

{ pkgs ? import <nixpkgs> { } }:
with pkgs; mkShell {
  ANDROID_HOME = "${androidsdk_extras}/libexec";

  nativeBuildInputs = [
    androidsdk_extras
    jdk
    nodejs-9_x
  ];
}

It’s also worth mentioning this PR, which adds multiple versions of buildTools: androidenv: autogenerated build-tools and addons repositories by yorickvP · Pull Request #37805 · NixOS/nixpkgs · GitHub

1 Like

There’s also obelisk which was recently announced. Not sure about the details of how to use it though, I haven’t tried it myself.

Thank you, i will take a look into the PR

I have tried obelisk, but it seems that it is too opinionated for me and i never try for android fwiw (just use it for haskell project)

how do you start emulator with this? I can’t in my machine. There seems to be no system images (in ${androidsdk}/libexec/system-images)

The result of android list targets is:

Available Android targets:
----------
id: 1 or "android-26"
     Name: Android 8.0.0
     Type: Platform
     API level: 26
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.