Skip to content

cargo android run does not respect $*_HOME #122

@mamins1376

Description

@mamins1376

I have set $RUSTUP_HOME and $CARGO_HOME to non-default values in my setup, and trying to build for android gave me the following results:

$ cargo android run
...
error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:rustBuildArm64Debug'.
> Process 'command 'cargo'' finished with non-zero exit value 1

After some investigation, turns out cargo-android does not pass RUSTUP_HOME and CARGO_HOME environment variables down, resulting in the above error.

Current workaround: Make a symlink for each non-default path to the current one:

$ cd
$ rm -rf .rustup
$ ln -sr "$RUSTUP_HOME" .rustup
$ rm -rf .cargo
$ ln -sr "$CARGO_HOME" .cargo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions