inferrna / hello_world_android_egui

Egui + winit + wgpu + android example
MIT License
34 stars 2 forks source link

Can't build APK #6

Closed crabdancing closed 2 months ago

crabdancing commented 2 months ago

When trying to get the APK compiling on NixOS, I get the following:

> cargo apk build
Using package `hello_world_android_egui` in `/home/ada/Projects/rs/hello_world_android_egui/Cargo.toml`
Warning: Environment variable ANDROID_SDK_ROOT is deprecated (https://developer.android.com/studio/command-line/variables#envar). It will be used until it is unset and replaced by ANDROID_HOME.
thread 'main' panicked at /build/cargo-apk-0.9.6-vendor.tar.gz/ndk-build/src/ndk.rs:89:14:
Failed to read source.properties: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is confusing to me, because there was no source.properties in the git repo, yet somehow apparently it worked before?

Out of desparation, I tried xbuild too (as suggested by cargo-apk's README.md) and it gives me:

> x build --arch arm64 --platform android
[1/3] Fetch precompiled artifacts
Error: No such file or directory (os error 2)
crabdancing commented 2 months ago

Figured it out. Now I'm getting another error about 'no platforms installed'. Closing.

Had to do:

  android-sdk = inputs.android-nixpkgs.sdk.${system} (sdkPkgs:
        with sdkPkgs; [
          cmdline-tools-latest
          build-tools-34-0-0
          platform-tools
          platforms-android-34
          emulator
          ndk-bundle # this bit is important
          sources-android-34
        ]);
  devShells.default = craneLib.devShell {
     ANDROID_NDK_ROOT = "${android-sdk}/share/android-sdk/ndk-bundle";
  };