0

I am using Android Jetpack Compose to build a little app, and don't seem to be able to run terminal commands.

I have tried the following:

val cmdExample1 = arrayOf("sudo", "apt", "install", "curl")
val cmdExample2 = "sudo apt install curl"

... and the same without sudo.

Runtime.getRuntime().exec(cmdExampleHere)

What I get is the following error;

Cannot run program "apt": error=2, No such file or directory

or, of course

Cannot run program "sudo": error=2, No such file or directory

Now, I know neither sudo nor apt are builtins, but how am I supposed to perform such a simple operation? And most importantly... where can I find documentation on the Android builtin terminal!!

6
  • 3
    Thats not really something you can do especially if your device is not rooted. Maybe if you explain in your question what you are trying to accomplish we can help further Commented Aug 18 at 20:03
  • 2
    You'd need to have sudo and apt actually installed on the device. To do that, you need to root the device and install them yourself. Then you could run the command. Installing su is one of the major steps in rooting. Commented Aug 18 at 23:22
  • @tyczj My goal is to install the Arduino CLI via CURL on the device, and then start its daemon. My app is an IDE that replaces the Electron desktop app they normally provide. Commented Aug 19 at 6:19
  • @GabeSechan I see, thank you for your explanation. Do you by any chance know if the builtin Linux terminal provides any other HTTP clients? I read that somewhere, in a post from 2015, but cannot find any docs Commented Aug 19 at 6:22
  • 1
    @FiLiPpo it is unlikely that the Arduino CLI will even be able to be installed let alone work on android. Just because Android is Linux based does not mean you can expect to do everything you can in Linux especially inside of a sandboxed app process Commented Aug 19 at 12:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.