Skip to content

Cannot run program "rustc" In Android Studio Ladybug | 2024.2.1 Patch 1 'RUN' menu action. #4

Closed
@Haoxiqiang

Description

@Haoxiqiang

I have a weird problem, but could you please look into it?
If I click the ide menu trigger actions, for example, 'gradle sync', 'build', 'run'...
I will see an interrupt exception like this:

Cannot run program "rustc" (in directory "xxxx/app"): error=2, No such file or directory
	at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)

first I checked the PATH, and tested the command rustc/rustup/cargo. in the terminal, and all works well.
I try the source code and try more tests:

IT WORKS.
project.exec {
    executable = "echo"
    args = listOf("Hello, World!")
    standardOutput = System.out
    errorOutput = System.err
}
IT NOT WORKS.
project.exec {
    environment("PATH", System.getenv("PATH"))
    executable = "rustc"
    args = listOf("--version")
    standardOutput = System.out
    errorOutput = System.err
}
IT WORKS.
project.exec {
    executable = "/xxx/xx/rustc"
    args = listOf("--version")
    standardOutput = System.out
    errorOutput = System.err
}
before project.exec 
I print System.getenv( "PATH" )
the var is right and contains rust dir

I'm even more confused.
in the terminal, I tested this:

IT WORKS AND BUILD SUCESS.
./gradlew assembleDebug
> Task :app:buildDebugAdblockRust[arm64-v8a]
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s

> Task :app:buildDebugAdblockRust[armeabi-v7a]
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s

> Task :app:buildDebugAdblockRust[x86]
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s

> Task :app:buildDebugAdblockRust[x86_64]
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s

BUILD SUCCESSFUL in 2s

Could you give some advice on this situation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions