8

I actually didn't want to install Android Studio to use flutter, so i just installed the Android SDK Command Line Tools.

The thing is, when i run flutter doctor i get the following warning.

Running flutter doctor

And when i create a new project i get this one.

enter image description here

I am able to create and compile flutter projects without any issues, it is only the warning that worries me. Could it cause dependency trouble in the future for java related packages?

Bata
  • 183
  • 2
  • 6
  • 17

3 Answers3

19

Execute these commands one by one and it resolved my issue in MAC .

cd /Applications/Android\ Studio.app/Contents/jre

ln -s ../jre jdk

ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

Sateesh Pasala
  • 772
  • 8
  • 15
7

Please ensure Java is in your PATH and that JAVA_HOME is defined and pointing to the JDK. I've had Windows put the JRE in the path instead of the JDK, which leads to all kinds of issues.

Please take a look at your PATH environment variable and remove everything Java related that does not point to the JDK folder.

Oracle has some documentation on how to do this here : Installing Java and setting JAVA_HOME.

I hope I was able to help you.

Julien J
  • 2,826
  • 2
  • 25
  • 28
  • You have last version? – Julien J Feb 03 '20 at 22:45
  • Previously i was using OpenJDK 13, but it wasn't compatible with Android SDK and wouldn't let me install it because java issues. Currently i switched to JDK 8u202 and it works just fine. – Bata Feb 03 '20 at 22:48
  • facing the same issue. I install jdk8 32 bit as it didn't worked with 64 bit and pointed %JAVA_HOME% to 32bit now.. But so far no luck – user3698694 Aug 20 '20 at 00:02
  • Thanks. This solved it for me. I had an old version saved in JAVA_HOME (11.0.10), while i had 11.0.13 on my machine. Also, notice that you have to close and reopen the shell in order for the new env variable to be read. – Federico Bicciato Oct 27 '21 at 16:17
1

Just to add, I had 2 versions of Android studio. And I removed one. So there might be a possibility that you have an older/another version of Android Studio present in your machine.

Ankit Gupta
  • 674
  • 1
  • 6
  • 17