Error to run Android Studio

后端 未结 17 2086
执笔经年
执笔经年 2020-12-22 17:43

I have installed Android Studio and I followed all steps described here

But when I start studio.sh I got an error with this message:

17条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 18:11

    Check if your Java JDK is installed correctly

    dpkg --list | grep -i jdk
    

    If not, install JDK

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update && sudo apt-get install oracle-java8-installer
    

    After the installation you have to enable the jdk

    update-alternatives --display java
    

    Check if Ubuntu uses Java JDK 8

    java -version
    

    If all went right the answer should be something like this:

    java version "1.8.0_91"
    Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
    

    Check what compiler is used

    javac -version
    

    It should show something like this

    javac 1.8.0_91
    

    Finally, add JAVA_HOME to the environment variable

    Edit /etc/environment and add JAVA_HOME=/usr/lib/jvm/java-8-oracle to the end of the file

    sudo nano /etc/environment
    

    Append to the end of the file

    JAVA_HOME=/usr/lib/jvm/java-8-oracle
    

    You will then have to reboot, you can do this from the terminal with:

    sudo reboot
    

    In case you want to remove the JDK

    sudo apt-get remove oracle-java8-installer
    

提交回复
热议问题