fattoliu commented on issue #1554: URL: https://github.com/apache/cordova-android/issues/1554#issuecomment-3247902085
> I can't really answer for third-party CLI tools, I don't use them.我无法真正回答第三方 CLI 工具的问题,我不使用它们。 > > ``` > **Command failed with exit code 1: avdmanager list target** > 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.AvdManagerCli.run(AvdManagerCli.java:213) > at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200) > Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) > at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) > ... 5 more > ``` > > I'm fairly certain this is the error you get if you mismatch Android SDK tooling with java versions. The Android SDK includes two sets of the same tools, once is for Java 8, the other is for Java 11.我相当确定,如果你将 Android SDK 工具与 Java 版本不匹配,你会得到这个错误。Android SDK 包含两套相同的工具,一套是为 Java 8 准备的,另一套是为 Java 11 准备的。 > > The java 8 tooling I'm pretty sure is automatically bundled with the android SDK under `$ANDROID_HOME/tools` / `$ANDROID_HOME/tools/bin`. So ensure these paths are **not** in your `PATH` variable, as they will not work if you're using Java 11.我相当确信,Java 8 工具是在 android SDK 中自动捆绑的,位于 `$ANDROID_HOME/tools` / `$ANDROID_HOME/tools/bin` 。所以请确保这些路径不在你的 `PATH` 变量中,因为如果你使用 Java 11,它们将无法工作。 > > Instead, using the SDK Manager, install the `cmdline-tools` package. I'm using version 7.0 right now just fine. Then you can add `$ANDROID_HOME/cmdline-tools/7.0/bin` to your `PATH`. These binaries are compatible with Java 11. If you use a different version, make sure you adjust your PATH as the version is in the path.相反,使用 SDK Manager 安装 `cmdline-tools` 包。我现在使用的是版本 7.0,效果很好。然后你可以将 `$ANDROID_HOME/cmdline-tools/7.0/bin` 添加到你的 `PATH` 。这些二进制文件与 Java 11 兼容。如果你使用不同的版本,请确保调整你的 PATH,因为版本就在路径中。 > > > **'sh' is not recognized as an internal or external command,'sh'不是内部或外部命令,** > > I'm guessing it's trying to start the emulator and is attempting to run a sh command on the emulator, but if the `avdmanager` binaries aren't working because of the mismatch of java versions, it will fail. So this is probably a side effect error of your first problem.我猜它正在尝试启动模拟器,并尝试在模拟器上运行 sh 命令,但如果由于 Java 版本不匹配, `avdmanager` 的二进制文件无法工作,它将失败。所以这很可能是你第一个问题的副作用错误。 > > Lastly, I know you're using Windows, so my `$ANDROID_HOME/tools` examples are not going to be identical as they are based on unix environments... I don't develop on a windows machine, so I'm not very familiar with how they represent things. I'm assuming that you have the know how to set up environment variables on Windows. I think windows uses `%ANDROID_HOME%` for environment variables. `$ANDROID_HOME` should be the path to the root android sdk folder.最后,我知道你在使用 Windows,所以我的 `$ANDROID_HOME/tools` 示例不会完全相同,因为它们是基于 Unix 环境的...我不在 Windows 机器上开发,所以我对它们如何表示事物不太熟悉。我假设你知道如何在 Windows 上设置环境变量。我认为 Windows 使用 `%ANDROID_HOME%` 作为环境变量。 `$ANDROID_HOME` 应该是根 Android SDK 文件夹的路径。 > > > the /jre path does not contain anything but an empty file named/jre 路径不包含任何内容,只有一个名为 > > Perhaps windows has a different folder structure. To be clear this is not the Android SDK folder, but the Android Studio folder. But on Linux you download Android Studio as one big tarball archive whereas on windows you get an actual installer, so the structure could be very different.可能 Windows 的文件夹结构不同。为了明确,这并不是 Android SDK 文件夹,而是 Android Studio 文件夹。但在 Linux 上,您下载 Android Studio 时是一个大的 tarball 存档,而在 Windows 上,您得到的是一个实际的安装程序,所以结构可能非常不同。 Thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
