Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
868 views
in Technique[技术] by (71.8m points)

java - Error:Could not initialize class com.android.sdklib.repositoryv2.AndroidSdkHandler

I want to build this project with Android Studio at launching, but take a error. Stacktrace is here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This problem occurs when there are multiple JDKs installed in your system, I had the same issue as I had mistakenly installed oracle-jdk-9 and Android studio requires oracle-jdk-8

If you are using Ubuntu you can install jdk-8 from this question.

So, Make following changes as shown below:

Press ctrl+shift+alt+s that will open project structure which can also be opened from

File -> Project Structure

And then change JDK Location where you may have installed JDK 8

Here is the link to image


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...