Android Studio error after ./studio.sh

前端 未结 12 1184
名媛妹妹
名媛妹妹 2021-01-30 10:49

After ./studio.sh in a terminal I get this error \"tools.jar is not in android studio classpath Please ensure JAVA_HOME points to JDK rather than JRE\"

相关标签:
12条回答
  • 2021-01-30 11:02

    I have figured it out. You need to install openjdk-jdk. Opensjdk-jre is not enough. So in terminal all you need to do is write sudo apt-get install openjdk-7-jdk then press yes. Open the android studio bin folder, double click on studio.sh, open in terminal, press enter, and then android studio should work.

    0 讨论(0)
  • 2021-01-30 11:02

    the solution for me was to modify studio.sh and add JAVA_HOME as a variable:

    # ---------------------------------------------------------------------
    # Locate a JDK installation directory which will be used to run the IDE.
    # Try (in order): STUDIO_JDK, ../jre, JDK_HOME, JAVA_HOME, "java" in PATH.
    # -------------------------------------------------------------------
    
         JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-i386/
    
    if [ -n "$STUDIO_JDK" -a -x "$STUDIO_JDK/bin/java" ]; then (etc..)
    
    0 讨论(0)
  • 2021-01-30 11:03

    This below trick work for me , Check your app dependencies in build.gradle(Project:AppName) .

    Try the latest build.gradle version.

    classpath 'com.android.tools.build:gradle:2.2.1'

    0 讨论(0)
  • 2021-01-30 11:04

    You have to have the latest JDK. I solved it by
       sudo apt-get install openjdk-8-jdk
    (Note the '8' in there)

    0 讨论(0)
  • 2021-01-30 11:05

    This is what I did to solve the problem:

    cd /opt/ (where android-studio directory is located)

    sudo chown -R your_user:your_user android-studio

    (where your_user is... yes your username :) )

    0 讨论(0)
  • 2021-01-30 11:07

    This seems like permission problem. Someone who packed Android Studio, has the original files under non-root account. If you unpack it as root, the files and dirs has no permission for "other" (just for owner). The person who is packing Android Studio knows a lot about Android and Java, but not much about Unix permissions (uch!). There are two possible solutions:

    a) unpack android-studio-bundle-...-linux.tgz as normal user, not as root (this has an advantage - you will be able to update Andriod Studio by clicking menu; but this is generally stupid because you are open to malware attack)

    b) fix read permissions for files and dirs for whole android-studio directory with something like: chmod -R +r /opt/android-studio

    0 讨论(0)
提交回复
热议问题