Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An issue with Android Studio running on Linux

I have recently installed Android Studio on Manjaro Linux, but I am experiencing issues every time I have to run the application from the scratch. Namely, in order to start application, I have to be logged in as root, then I have to validate JAVA_HOME environmental variable and finally start the application with ./studio.sh

Here is the full code of that:

[nikodroid@manjaro ~]$ cd /usr/share/applications/android-studio/bin
bash: cd: /usr/share/applications/android-studio/bin: Permission denied
[nikodroid@manjaro ~]$ sudo su
[sudo] password for nikodroid: 
[root@manjaro nikodroid]# cd /usr/share/applications/android-studio/bin
[root@manjaro bin]# ./studio.sh 
which: no java in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl)
ERROR: Cannot start Android Studio\nNo JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.
[root@manjaro bin]# cd /usr/java/
[root@manjaro java]# export JAVA_HOME=/usr/java/jdk1.7.0_21/
[root@manjaro java]# export PATH=$PATH:$JAVA_HOME/bin
[root@manjaro java]# cd /usr/share/applications/android-studio/bin/
[root@manjaro bin]# ./studio.sh

So, obviously this runs only when I am keeping the terminal session, once I exit, the application stops working. My question is, what can I do in order to not do this all every time I want to run the application?

Just to mention, I put the following line

JAVA_HOME=/usr/java/jdk1.7.0_21/

in /etc/environment/ in order to persist this environment variable, but it seems that it didn't work.

Thanks!

like image 246
nikodroid Avatar asked May 18 '13 23:05

nikodroid


People also ask

Is Android Studio good on Linux?

The experience is identical on all three operating systems, because Android Studio is platform-agnostic. It's a bog-standard JetBrains IDE written in Java. Nothing changes. There are others who claim that Linux is better because it is less resource-intensive.

Does Android Studio runs faster on Linux?

Linux performs better for Android Studio than Windows. Android Studio needs at least 8 GB RAM to run better. Change your Hard Disk to SSD. Loading/Compiling/Designing/Writing time will be reduced even in 4GB RAM.

Can Android development be done on Linux?

Get Started with Android application development using Linux and Android SDK. Developers interested in the Android mobile operating system are able to use the Android SDK and various IDE software to code applications. These apps can then be made available and marketed to Android users around the world.

Why is my Android Studio emulator not working?

If the emulator fails to launch due to the error vulkan-1. dll cannot be found , you probably need to update the emulator. To update the emulator in Android Studio, go to Tools > SDK Manager and install the latest stable version of Android platform.


2 Answers

install JRE and JDK with apt

for JRE: sudo apt-get install default-jre for JDK: sudo apt-get install default-jdk

check if all is ok with: java -version

then continue installation Android Studio

like image 35
Suleyman BAL Avatar answered Oct 13 '22 13:10

Suleyman BAL


It really was a permission issue, as I looked and found out that the owner and group were messed up, so what I did is changing the permission/ownership with:

chown -R root:root android-studio

After this, I just changed the dir with:

cd /usr/share/applications/android-studio/bin

and ran

./studio.sh

It loaded the application without any errors.

like image 189
nikodroid Avatar answered Oct 13 '22 12:10

nikodroid