“Could not find or load main class java.se.ee” while running sdkmanager --licences

时间秒杀一切 提交于 2019-12-06 17:26:19

问题


When building my project on android studio, it asks me to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.

When I run "./sdkmanager --licenses", I have the "Could not find or load main class java.se.ee" error.

I found a lot of similar issues on stackoverflow, but non of the solutions provided worked for me.

I already tried: 1- downgrade to java 8

2- export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'

3- change sdkmanager file by adding : DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'


回答1:


I had the same issue.
And solved by following the below steps:

1) Install java 8

2) Run command in terminal

unset JAVA_OPTS

3) Then run command in terminal

./sdkmanager --licenses




回答2:


Well, it's been 4 months since you asked the question. You must have found the answer, but here is a way easy solution for others who are still looking for it:

JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions'

And, Voila the issue is solved!

Why this solved the problem?

Well I don't know the exact reason but, I also don't know why we tend to add java.se.ee through "--add-modules java.se.ee", I tried removing it and error was gone! Maybe because java11 removed EE module, and it was depreciated in java10.

It was just a blind shot which worked!, If anyone knows the proper reason please comment it out!




回答3:


Unsetting JAVA_OPTS worked for me.

unset JAVA_OPTS
sdkmanager --list
dkmanager "platform-tools" "platforms;android-28"



回答4:


Below steps helped me get past above Java error.

JDK Version:

sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: <Choose Java 8>

Procedure:

  1. unset JAVA_OPTS
  2. In folder ~/Android/Sdk/tools/bin$ sudo nano ./sdkmanager
  3. Change line# 31 to

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions'

  1. Save the file and exit
  2. ./sdkmanager --list

    Installed packages:=====================] 100% Computing updates...
    Path | Version | Description | Location
    ------- | ------- | ------- | -------
    build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/



来源:https://stackoverflow.com/questions/54287619/could-not-find-or-load-main-class-java-se-ee-while-running-sdkmanager-licenc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!