Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio cannot use secure connection for update, complaining the use of Java 6

In Android Studio's Preferences -> Appearance & Behavior -> System Settings -> Updates, I tried to enable the Use secure connection option:

enter image description here

But when I clicked the Apply button, the error "Secure connection is not supported on Java 6" showed up:

enter image description here

I checked the JDK location setting in Project Structure, and it's /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home:

enter image description here

It seems that I'm using Java 7, not Java 6. Then why the secure connection setting complains about not supported by Java 6?


In case needed, below is the installed JDKs on my machine: enter image description here

The first one 1.6.0.jdk is from Apple, and the other 3 are from Oracle.

like image 667
goodbyeera Avatar asked Apr 10 '16 12:04

goodbyeera


2 Answers

This problem occurs on Mac OS. The project JDK (the JDK used for compiling your code) is different from the IDE JDK (the JDK used to run the IDE)

Your project JDK is 7, but your IDE JDK is 6.

For your case, you can add an environment variable for the IDE (by Terminal) as below:

export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk

Check these documents for more information:

http://tools.android.com/tech-docs/configuration/osx-jdk

http://tools.android.com/tech-docs/configuration

Happy coding!

like image 167
vietstone Avatar answered Nov 14 '22 00:11

vietstone


Exporting environment variable didn't work for me. Editing plist file did.

nano /Applications/Android\ Studio.app/Contents/Info.plist

And find this line:

<key>JVMVersion</key>
<string>1.6*</string>

Change the value from 1.6* to 1.7+

like image 31
Ernest Zamelczyk Avatar answered Nov 14 '22 01:11

Ernest Zamelczyk