Command sdkmanager not working

Hello guys,

i installed android studio and sdk and exported the path but “sdkmanager” command is not known in terminal
so executing cd /Android/Sdk/tools/bin/ ./sdkmanager is showing this error :

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        ... 5 more

i tried setting jre path in sdkmanager config but still did not work.

can u guys guid me to solve this ? thank you for the effort of reading this.

I think this is the issue:

echo $PATH

should list the directory where it is

android-sdk is installed in /opt
specifically:
/opt/android-sdk/tools/bin

that is where the sdkmanager binary is

I don’t think that path is correct - but I don’t have android studio installed

sdkmanager is part of android-sdk and is in
/opt/android-sdk/tools/bin/sdkmanager

thanks for your reply , /opt does not contain android-sdk, went to android studio found its : /home/hamdi-alaa/Android/Sdk

jre is the problem, but can’t place my hands exactly on it

then your issue stems from how you installed it

pretty sure you did not install either of the two via standard methods
(Manjaro repository or AUR)

because, if you do that
android-sdk is installed in /opt
and so is android-studio

both android studio and sdk are in the AUR and
if installed from there
are in /opt/...

If you did it any other way then I’m pretty certain that I can’t assist without asking for a lot of more information on how you did it.
The first of which would be:
why? :wink:

@Nachlese haha i did almost the same steps 3 months ago and it worked, i installed android studio from AUR and sdk from the android studio.

Now i tried reinstalling sdk, but still nothing
im exporting : export ANDROID_HOME="$HOME/Android/Sdk" in file .bashrc
when i do : echo $ANDROID_HOME
it returns /home which it is weird.

Any idea why ?
Also should i delete sdk from android studio and install sdk manager from repository ?

@Nachlese i solved the export issue where i put my paths in .zshrc:

export ANDROID_HOME="$HOME/Android/Sdk"
export PATH=$PATH:"$ANDROID_HOME/tools"
export PATH=$PATH:"$ANDROID_HOME/emulator"
export PATH=$PATH:"$ANDROID_HOME/tools/bin"
export PATH=$PATH:"$ANDROID_HOME/platform-tools"

echo $ANDROID_HOME now works properly and sdkmanager command works.
But when i execute sdkmanager i get the same error message :

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        ... 5 more

any idea why ? i think its related to jre.

only ideas
I can’t decode the error message - no experience at all

It may be related to jre
Is it properly in your $PATH ?

my $PATH - with the tools installed from the AUR - looks like this:

echo $PATH
/home/nachlese/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

this is mine - and I’m using bash
you are using zsh …

hi again @Nachlese, i fixed the jdk jre problem and i have a new problem,

After running yarn start and when running yarn android
the console of yarn start breaks with this error:

I did sudo chmod -R 777 /home/hamdi-alaa/Desktop/Shipzzer/shipzzer-react-native/ for the folder android and node_modules then for the whole projet, and still nothing changed.

Any advice how to solve this ?

I have no experience with these and in fact no idea what these programs even are that you are using
and even less so regarding any error that occurs.
:man_shrugging: