Export a game for Android. Error by use 'sdkmanager' command for complete the setup process of Android SDK

Godot Version

Godot 4.3 Stable Mono (C#)

OpenJDK Version

OpenJDK 17

Question

Hello! I try to export my game for test for Android platform. I follow official guide about export here and chose alternative variant without download a Android Studio. After download and unzip the Command-line Tools package, I try to use the sdkmanager command to complete the setup process:

sdkmanager --sdk_root=<android_sdk_path> "platform-tools" "build-tools;34.0.0" "platforms;android-34" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;23.2.8568313"

At --sdk_root=<android_sdk_path> I write --sdk_root=D:\Android\cmdline-tools\latest where the extracted Command-line Tools is located. But I get this error, which I couldn’t find a solution to on the Internet:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "javax.xml.bind.JAXBContext.createUnmarshaller()" because "context" is null
        at com.android.repository.impl.meta.SchemaModuleUtil.setupUnmarshaller(SchemaModuleUtil.java:218)
        at com.android.repository.impl.meta.SchemaModuleUtil.unmarshal(SchemaModuleUtil.java:195)
        at com.android.repository.impl.sources.RemoteListSourceProviderImpl.parse(RemoteListSourceProviderImpl.java:176)
        at com.android.repository.impl.sources.RemoteListSourceProviderImpl.getSources(RemoteListSourceProviderImpl.java:155)
        at com.android.repository.impl.manager.RemoteRepoLoaderImpl.fetchPackages(RemoteRepoLoaderImpl.java:102)
        at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:615)
        at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:417)
        at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:415)
        at com.android.repository.impl.manager.RepoManagerImpl.loadSynchronously(RepoManagerImpl.java:300)
        at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:296)
        at com.android.sdklib.tool.sdkmanager.InstallAction.execute(InstallAction.java:56)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.run(SdkManagerCli.java:104)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:81)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)

If you have encountered this problem, please help me find a solution. I can’t download Android Studio for a number of reasons, so this is the only path I can use for exporting. Thanks for any help!

Bro you need to download Android Studio in order to get your app/game running.
First make sure you have sdkmanager. if not try this website for help then run the command you mentioned above.

Also make sure you have installed JDK in your system.

So, I can’t download Android Studio at this time for a number of reasons. That’s why I downloaded only Command-Line Tools. The official guide says that it is not necessary to download Android Studio — as an alternative, you can download Command-Line Tools and download the necessary packages through it:

Alternatively, you can install the Android SDK with the sdkmanager command line tool.
Install the command line tools package using these instructions.
Once the command line tools are installed, run the following sdkmanager command to complete the setup process…

JDK 17 is installed, I checked that by write java -version at command line.

Read it again you must need to install the Android SDK either by Gui or command-line tool.

Yes, but Command-line Tools (sdkmanager) give error when I try to install Android SDK by it.

did you use proper command for installing can you share it

did you provide a path here or not like c:\your_path\

something like that

Yes. :thinking:

which version of jdk you are using. I guess the problem is within the java. it did not execute the command.
Also make sure your enviroment variables are set properly for jdk. Sometime this is cause of error as well.

I solved the problem in a different way. I manually downloaded the necessary tools from various web resources myself. By downloading a total of three tools from the Android SDK: build-tools, cmdline-tools, and platform-tools I was able to export the game without any problems and have already tested it on my phone.
Anyway, thank you, @sunnanabdullah, for your help and time.

1 Like

Glad to hear you solved it. :innocent:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.