ubuntu / ubuntu-make

Easy setup of common tools for developers on Ubuntu.
GNU General Public License v3.0
1.2k stars 189 forks source link

Fix java.lang.IllegalArgumentException with android sdkmanager #631

Closed lanzorg closed 4 years ago

lanzorg commented 4 years ago

This is how I installed android-sdk from ubuntu-make:

# Install the default-jdk package.
sudo apt install -y default-jdk

# Install the ubuntu-make package.
sudo add-apt-repository -y ppa:lyzardking/ubuntu-make
sudo apt install -y ubuntu-make

# Install the android-sdk package.
umake android android-platform-tools "${HOME}/.local/share/umake/android/android-platform-tools" --accept-license
umake android android-sdk "${HOME}/.local/share/umake/android/android-sdk" --accept-license
source "${HOME}/.profile"
yes 'y' | sdkmanager 'platforms;android-29'
sdkmanager --update

But I have this error (even with sdkmanager --version):

java.lang.IllegalArgumentException
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
LyzardKing commented 4 years ago

Did you try a logout? It's a strange issue.. if it persists it might be a missing dependency, although I believe that the sdk contains all the java libraries needed

lanzorg commented 4 years ago

Yes, I tried logout and reboot.

It seems I have the same issue than in this stackoverflow question: https://stackoverflow.com/questions/60440509/android-command-line-tools-sdkmanager-always-shows-warning-could-not-create-se

LyzardKing commented 4 years ago

It seems to be an issue with the android tools, not umake, or is the variable missing?

lanzorg commented 4 years ago

Here's how to make sdkmanager work with umake:

# First install android-sdk with umake.
umake android android-sdk "${HOME}/.local/share/umake/android/android-sdk" --accept-license

# We have to move the tools directory to cmdline-tools.
mkdir "${HOME}/.local/share/umake/android/android-sdk/cmdline-tools"
mv "${HOME}/.local/share/umake/android/android-sdk/tools" "${HOME}/.local/share/umake/android/android-sdk/cmdline-tools"

# Now sdkmanager is working.
"${HOME}/.local/share/umake/android/android-sdk/cmdline-tools/tools/bin/sdkmanager" --update

# TODO: Change the PATH to make sdkmanager available directly.

Here is the working file architecture:

I don't know why Google did't fix that yet?
But, it could be easy to implement this workaround into umake.

adeept commented 4 years ago

Hello,

Pls tell the specific name of the product.

Best!

2020-06-10

Adeept Technical Support Team Shenzhen Adeept Technology Co., Ltd. E-mail: support@adeept.com Website: www.adeept.com

发件人:lanzorg notifications@github.com 发送时间:2020-06-10 16:19 主题:Re: [ubuntu/ubuntu-make] Fix java.lang.IllegalArgumentException with android sdkmanager (#631) 收件人:"ubuntu/ubuntu-make"ubuntu-make@noreply.github.com 抄送:"Subscribed"subscribed@noreply.github.com

Here's how to make sdkmanager work with umake:

First install android-sdk with umake.

umake android android-sdk "${HOME}/.local/share/umake/android/android-sdk" --accept-license

We have to move the tools directory to cmdline-tools.

mkdir "${HOME}/.local/share/umake/android/android-sdk/cmdline-tools" mv "${HOME}/.local/share/umake/android/android-sdk/tools" "${HOME}/.local/share/umake/android/android-sdk/cmdline-tools"

Now sdkmanager is working.

"${HOME}/.local/share/umake/android/android-sdk/cmdline-tools/tools/bin/sdkmanager" --update

TODO: Change the PATH to make sdkmanager available directly.

Here is the working file architecture:

I don't know why Google did't fix that yet? But, it could be easy to implement this workaround into umake. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

LyzardKing commented 4 years ago

Fixed in commit https://github.com/ubuntu/ubuntu-make/commit/a1b1011a8953f07e23f813d93deafb9c15aa40d6