Skip to content

cargo apk build gives No such file... without further info #48

@TomMD

Description

@TomMD

In a nut shell:

~/dev/rust-android-examples/na-mainloop]$ cargo apk build
Using package `na-mainloop` in `/home/tommd/dev/rust-android-examples/na-mainloop/Cargo.toml`
Error: No such file or directory (os error 2)

This is after a system setup which I tried to capture:

  1. Have rustup and java jdk:
$ nix-shell -p jdk -p rustup
  1. Download the 'commandline only' tools (https://developer.android.com/studio) and use sdkmanager to get the sdk
    unzip thing and cd in then
$ export ANDROID_HOME=$(pwd)
$ $ANDROID_HOME/bin/sdkmanager --sdk_root=$ANDROID_HOME --install "build-tools;34.0.0" "cmdline-tools;latest" "extras;android;m2repository" "ndk;26.1.10909125" "platforms;android-31"

(Notice the 'ANDROID_SDK_HOME' envvar is deprecated, contrary to the readme)

  1. Download the NDK (https://developer.android.com/ndk/downloads)
    unzip thing and cd
$ export ANDROID_NDK_HOME=$(pwd)
  1. Run a demo (https://github.com/rust-mobile/rust-android-examples/tree/main/na-mainloop)
$ rustup default 1.70.0
$ rustup target install aarch64-linux-android
$ git clone https://github.com/rust-mobile/rust-android-examples
$ cd rust-android-examples/na-mainloop
$ cargo install cargo-ndk
$ cargo ndk -t arm64-v8a -o app/src/main/jniLibs/  build
$ cargo install cargo-apk
$ cargo apk build
Using package `na-mainloop` in `..../dev/rust-android-examples/na-mainloop/Cargo.toml`
Error: No such file or directory (os error 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions