agusgambina
agusgambina

Reputation: 6679

starting Android Device Monitor from Android Studio in Ubuntu 14.10

I am trying to start Android device monitor from Android Studio, but I get this error message

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Monitor. No Java virtual machine was found after searching the following locations: /home/agusgambina/Android/Sdk/tools/lib/monitor-x86_64/jre/bin/java java in your current PATH

If in a terminal I execute

$ javac -version

I get this

javac 1.7.0_80

So I have declared the java compiler on the PATH, I don't know what I have to change to make it work

Thank you

Upvotes: 3

Views: 6935

Answers (6)

owen_lee
owen_lee

Reputation: 1

You can make sure the location of the JRE in Project Structure UI which is in File menu. And then you just link the jre directory in {you sdk home path}/tools/lib/monitor-x86_64.

Upvotes: -1

Jing Wang
Jing Wang

Reputation: 71

This problem had troubled me a long time.

I found a solution:

  1. open termimal
  2. cd {you sdk home path}/tools/lib/monitor-x86_64
  3. mkdir jre
  4. cd jre
  5. ln -s {you java home path}/bin bin

To find your Java home path type:

echo $JAVA_HOME

If nothing appears type: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

Actually, I just created a link to your Java home. But I am confused why Android Studio finds Java in this path.

Upvotes: 7

SpyZip
SpyZip

Reputation: 5540

What worked for me was just sudo apt-get install default-jdk then restart Android Studio and the Device Monitor worked

Upvotes: 1

rahul
rahul

Reputation: 71

Create a new file or edit the existing file called .bash_profile in your home directory:

E.g. vi ~/.bash_profile Insert the following lines and adopt the paths to where your jdk is installed (probably it won't be /home/anuradha/installs/jdk1.7.0_02:

JAVA_HOME=/home/anuradha/installs/jdk1.7.0_02
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JRE_HOME=/home/anuradha/installs/jdk1.7.0_02
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Source the .bash_profile, e.g. by calling . ~/.bash_profile or by opening a new terminal.

Check the java version by running java -version.

Upvotes: 0

Bhoomit_BB
Bhoomit_BB

Reputation: 374

go to your Android Studio JDK path (If you don't know then see it from File->Other Settings->Default Project Structure->SDKs in android studio)

(in ubuntu it is normally /usr/local/jdk1.x.x)

inside jdk folder copy jre folder and paste it to your android studio assuming path which is in your case "/home/agusgambina/Android/Sdk/tools/lib/monitor-x86_64/"

paste it inside monitor-x86_64 folder in sdk

Hope this will work!

Upvotes: 14

James Wierzba
James Wierzba

Reputation: 17548

Look at your path environment variable (echo $PATH) to see where the OS is finding java.

Verify that the path to java is the same as the path that android-studio is assuming it to be. (/home/agusgambina/Android/Sdk/tools/lib/monitor-x86_64/jre/bin/java in your case)

If they are not the same, you will have to tell android-studio the correct path to java. (I believe the option can be found at File->Other Settings->Default Project Structure->SDKs)

b.t.w. javac is different from java

javac is the java compiler

java is the JVM exectuable (this is the one that is relevant in your problem)

Upvotes: 2

Related Questions