3

OS: Debian Stretch

Android Studio 3.4

JDK: open jdk 1.8

My Android studio build fails with following error:

Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

I set JAVA_HOME, STUDIO_JDK etc and tried various tricks with openjdk , with no luck.

My default JRE is set to default as recommended enter image description here

I am trying to update default JDK location as follow which given another error: enter image description here

Already killed couple of hours to resolve this issue. So give android studio 3.4, my questions are:

  1. What is wrong with the built-in compiler ?
  2. Is openJDK 1.8 is valid jdk for android studio 3.4 to build/compile projects ? Or do I need Oracle-jdk?
  3. I see oracle-jdk licensing has changed, can I use that for building commercial apps ?

Edit I found later that the issue was , debian stretch installed jvm only. I tried to run javac -version which fails since by default stretch got jre only. Later I fixed by installing openjdk-8-jdk which fixed the issue:

sudo apt-get install openjdk-8-jdk

javac -version

javac 1.8.0_212

sakhunzai
  • 13,900
  • 23
  • 98
  • 159

1 Answers1

1

I had the same error and while i parsing google i found an interesting site. In a lot of water i read the main information(in my opinion):

Android Studio requires Oracle Java 1.6 or later. It won’t work with OpenJDK.

I think we need to download oracle, becuase i see you are using java v 1.8 like me. I didn't try that, but i think it will work.

stillouyng
  • 11
  • 3