Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Device Monitor dependency on legacy Java SE 6 runtime

With Android Studio v2.2, the DDMS is deprecated in favor of Android Device Monitor. But when I try to open the Monitor, it doesn't open citing that it is dependant on legacy Java SE 6 runtime which in missing in my Mac Os Sierra. This is crazy, isn't it?

I want to try mocking incoming SMS, phone calls to the emulator from the monitor. And this monitor doesn't work with jdk 7/8. What is the way out??

like image 558
karthiks Avatar asked Jan 13 '17 13:01

karthiks


2 Answers

I am going to extend a bit more @karthiks's answer.

Probably you are in the situation where you have installed the latest version of the JDK, but you need JDK6 in order to use Android Device Monitor. The following steps allow you to keep your latest JDK as default, but define JDK6 for the directory where ADM is located.

  1. Install the legacy JDK6.
  2. Install jEnv:
    $ brew install jenv
  3. Add jEnv to the PATH:
    $ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
    $ echo 'eval "$(jenv init -)"' >> ~/.bash_profile
  4. Reload .bash_profile:
    $ source ~/.bash_profile
  5. Add your latest JDK to jEnv (in my case 1.8.0_131):
    $ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
  6. Add JDK6 to jEnv:
    $ jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  7. Define JDK6 for the directory where Android Device Monitor is located:
    $ cd ~/Library/Android/sdk/tools/
    $ jenv local 1.6
like image 195
David Miguel Avatar answered Nov 03 '22 02:11

David Miguel


I realised that the only way out of this is to install the legacy JDK6 in your mac. You can download it from Apple Support only.

You then have this worry of what happens to the latest JDK(/JRE) installed in your OS? The way I manage it is via JENV on command line.

Peace!

like image 1
karthiks Avatar answered Nov 03 '22 02:11

karthiks