question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Studio 0.9.1, OSX, JDK8 not found

See original GitHub issue

This is my current configuration:

Module’s build.gradle:

apply plugin: 'retrolambda'

retrolambda {
    jdk System.getenv("JAVA8_HOME")
    oldJdk System.getenv("JAVA6_HOME")
    javaVersion JavaVersion.VERSION_1_6
}

System env

dhcp-159-104-130-193:~ me$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
dhcp-159-104-130-193:~ me$ echo $JAVA8_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

AS GUI config:

JDK Location: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

And it’s still not finding it due to:

Error:Execution failed for task ':mobile:patchAndroidJar'.
> Retrolambda: null/jre/lib/rt.jar does not exist, make sure that the environment variable JAVA_HOME or JAVA8_HOME, or the gradle property retrolambda.jdk points to a valid version of java8.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

7reactions
stepangocommented, Dec 11, 2014

My solution for it.

String java8 = getJavaVersion(8)
String java7 = getJavaVersion(7)
retrolambda {
    jdk java8 //have tried with JAVA8_HOME
    oldJdk java7 //have tried with JAVA6_HOME
    javaVersion JavaVersion.VERSION_1_7 //have matched the above with VERSION_1_6
}

String getJavaVersion(Integer v) {
  def sout = new StringBuffer()
  def proc = "/usr/libexec/java_home -v 1.$v".execute()
  proc.consumeProcessOutput(sout, new StringBuffer())
  proc.waitForOrKill(1000)
  return sout.toString().replace("\n", "").replace("\r", "")
}
1reaction
pakoitocommented, Nov 6, 2014

I found a workaround by going to Android Studio -> Preferences -> Path Variables and adding

JAVA_8 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
Read more comments on GitHub >

github_iconTop Results From Across the Web

Android studio not installing even if JDK 8 is installed
I solved this problem by closing the installation file, and open it again as an administrator. Pre over the need to set jdk....
Read more >
VSMac states that OpenJDK 1.8.0.9 needs installing when it is ...
To point VS to this directory, open 'Preferences > SDK Locations > Android > Locations'. For 'Java SDK (JDK) Location' navigate or type...
Read more >
URGENT- "Java 11 or more recent is required to run ... - GitHub
I don't understand why today I'm getting this error. Managed to temporarily solve this by downgrading Language Support for Java(TM) by Red ...
Read more >
Configure Android Studio - Android Developers
Set the JDK version · Open your project in Android Studio and select File > Settings... > Build, Execution, Deployment > Build Tools...
Read more >
Java Runtime not found | Apple Developer Forums
When you install Java (JRE) and try build your app, the build now finds Javas JRE which has everything it is needs to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found