mozilla / rust-android-gradle

Apache License 2.0
1.03k stars 67 forks source link

CargoBuild error without any message #44

Closed bigdogs closed 3 years ago

bigdogs commented 3 years ago

Hi, I compile failed with the following message, but there is no useful error message.

Task :app:generateToolchains Toolchain for arch arm version 21 exists: checked /var/folders/rr/7h6c2bdd259_k2thf7m_phnh0000gn/T/rust-android-ndk-toolchains/arm-21 Toolchain for arch arm64 version 21 exists: checked /var/folders/rr/7h6c2bdd259_k2thf7m_phnh0000gn/T/rust-android-ndk-toolchains/arm64-21 Toolchain for arch x86 version 21 exists: checked /var/folders/rr/7h6c2bdd259_k2thf7m_phnh0000gn/T/rust-android-ndk-toolchains/x86-21 Toolchain for arch x86_64 version 21 exists: checked /var/folders/rr/7h6c2bdd259_k2thf7m_phnh0000gn/T/rust-android-ndk-toolchains/x86_64-21

Task :app:cargoBuildArm FAILED 7 actionable tasks: 6 executed, 1 up-to-date

FAILURE: Build failed with an exception.

BUILD FAILED in 638ms 4:27:44 PM: Task execution finished 'build'.

bigdogs commented 3 years ago

with --stacktrace flags added, it says that "No such file or directory" for cargo, Does anyone knows how to resolve this?

image

bigdogs commented 3 years ago

Solution still not found, but another plugin "https://github.com/willir/cargo-ndk-android-gradle" works for me.

issue closed

ncalexan commented 3 years ago

For the next person, you can set rust.cargoCommand in your local.properties, or an environment variable, or mangle your path: see https://github.com/ncalexan/rust-android-gradle/blob/master/README.md#specifying-paths-to-sub-commands-python-and-cargo.

Solution still not found, but another plugin "https://github.com/willir/cargo-ndk-android-gradle" works for me.

Just for your own info, we're thinking of promoting that plugin to "top of the stack" -- see the discussion in #40. I'm glad that plugin is working for you!

Progdrasil commented 3 years ago

I'm having the same issue, Unfortunately i cannot use the other gradle plugin as I cannot create Desktop builds to run my unit tests. I've tried setting the rust.cargoCommand to /usr/bin/cargo and /home/user/.cargo/bin/cargo and neither work.

ncalexan commented 3 years ago

@Progdrasil lots of logs and information about your configuration will be needed for us to get started tracking things down for you. Can you start by attaching ./gradlew --debug logs?

Osniackal commented 1 year ago

I had the same issue. I first tried to specify the cargo path, where it said Process 'command '/Users/{myname}/.cargo/bin/cargo'' finished with exit value -1 (state: FAILED). Running with --debug showed me the actual error, which was that my working_dir specified via module = "../rust" was invalid.

The solution for me was to specify it like this: module = "../../rust" as my project structure looked like this:

./android/app/build.gradle ./rust_project/cargo.toml