. Advertisement .
..3..
. Advertisement .
..4..
I am new to android and searching the “could not initialize class com android sdklib repository androidsdkhandler” to understand it better. It seems it doesn’t work as expected when I used some suggestions before.
Here is the command line I use:
react-native run-android
The error I’m getting is below:
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
Please give me the solution to this issue.
The cause:
This error happens due to JDK version 9. Java 9 officially has not supported building by Android tools yet. This causes such errors.
Solution:
This problem will be fixed by downgrading to Java version 8.
Another way can solve this error is setting $JAVA_HOME environment variable to your JDK installation. If you are using macOS, you can use the JDK bundled with Android Studio for it:
For Windows, your user or system variables pointing to only need to be added JAVA_HOME.
Then run react-native run-android again and the error will be solved.
This is because the classpath build tools for build.gradle root are no longer supported. This is how to update it
After that, update your minimum SDK and build tools to the latest version.