android-nixpkgs icon indicating copy to clipboard operation
android-nixpkgs copied to clipboard

Unable to recognize NDK (and Gradle?)

Open c4lliope opened this issue 1 year ago • 0 comments

Hello! I'm seeing an issue in the use of the NDK package. I'm inexperienced in Android and a beginner in Nix; apologies on any simple errors I make.

I am running nix-shell android.nix --run android-studio; here's android.nix:

{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
  android-nixpkgs = callPackage <android-nixpkgs> { };
  android-sdk = android-nixpkgs.sdk (sdkPkgs: with sdkPkgs; [
    cmdline-tools-latest
    build-tools-34-0-0
    platform-tools
    platforms-android-34
    emulator
    ndk-21-4-7075529
  ]);
in mkShell { buildInputs = [ android-studio android-sdk gradle ]; }

To begin, I had an error for a while regarding an unrecognized gradle; I had to change my distributionUrl inside gradle-wrapper.properties to use 8.4.

distributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip

Once I do this, gradlew pulls a copy of gradle rather than using the one I asked for in android.nix. Only a minor issue I guess.

My bigger problem is that the NDK is also unrecognized, and android has less luck pulling the missing copy to the read-only /nix/store.

Failed to install the following SDK components:
    ndk;21.4.7075529 NDK (Side by side) 21.4.7075529
The SDK directory is not writable (/nix/store/8vgf0v69gmkgyaxbvfs58rp9pfw6xdx5-android-sdk-env/share/android-sdk)

Maybe the problem is in the example app I am using - since no one else has opened these issues. I'm using https://github.com/elixir-desktop/android-example-app and only changed the line inside gradle-wrapper.properties as described earlier.

I hope someone can lend a couple hands and a keyboard to help me launch to Android again.

This same app had been surprisingly easy to build on Fedora, and I'd been eager to add mobile apps to my arsenal. Seems like the Android onboarding experience has had large upgrades in prior years, though on NixOS there remains a need to build from square one. Hope this issue helps more people use the NDK seamlessly.

c4lliope avatar Nov 28 '23 20:11 c4lliope