Error: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler

前端 未结 6 938
孤街浪徒
孤街浪徒 2020-12-14 00:13

I\'ve setup the environment for react native on Windows. But when I run the command

react-native run-android

I get the following errors -<

6条回答
  •  隐瞒了意图╮
    2020-12-14 00:49

    I encountered this error while running the following command in macOS

    ./gradlew assembleRelease --stacktrace
    

    and got the exact error posted. I solved the problem by setting $JAVA_HOME environment variable to your JDK installation. In my case I used the bundled JDK in Android Studio for macOS:

    export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
    

    for Windows, just add JAVA_HOME to your user or system variables pointing to

    "C://Program Files/Java/jdk_1.x_"
    

    folder and try running react-native run-android again.

提交回复
热议问题