Evusas Evusas - 1 year ago 85
Linux Question

Should Android Studio be run with sudo on Linux

I am facing issues when I need to, for example, download new Build-tools using the Standalone SDK Manager. It says it does not have permissions etc - so I run ./studio.sh with sudo, which fixes the problem.

I have not faced more problems yet, but what is the right way of running Android Studio on Linux - with, or without sudo rights? I do not want grant it rights if it can do without it.

Just to mention, Android Studio is placed at /opt/android-studio/...
And the SDK at ~/Android/Sdk/... (to my understanding this should not need root privileges?)


I keep getting access errors if running without sudo and simply trying to build the project.

Could not read path

Answer Source

I found the best solution so far the worked for me is a constructive answer:

  • sudo for Android Studio?

    It's usually good to minimize the programs you need to run as root. - @Kyle

    Run Android Studio without sudo

  • sudo for SDK Manager only

    You can run just the SDK manager by running the shell script "android" in the android-sdk/tools folder sudo sh /opt/android-sdk/tools/android - @Kyle

    Launch SDK Manager separately when an update is needed

  • Granting file access permissions

    if you wanted to run it as your own user, you could do that by changing ownership of the entire /opt/android-studio directory (recursively) - @matias elgart

    sudo chown -R youruser:youruser /home/fakepath/app - @num8er

    So in my case, I have changed the ownership of Android SDK folder for Android Studio to pick up the files without any problems. This has solved my issues:

    sudo chown -R myusername:myusername ~/fakepath/Android/Sdk/
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download