Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 571
Usm Avatar asked May 29 '16 18:05

Usm


2 Answers

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

like image 51
Mihir Shah Avatar answered Nov 09 '22 10:11

Mihir Shah


this because your classpath build tools in build.gradle root project is deprecated update like this for new android studio 3.2.0

buildscript {
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
}

and after that update your minimum sdk and build tools to latest and no problem again

like image 22
reza rahmad Avatar answered Nov 09 '22 10:11

reza rahmad