我在jitpack中得到这个错误,我已经在互联网上尝试了一切。以下是我的错误

Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-26 Android SDK Platform 26
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

当我运行。/sdkmanager——licenses

 All SDK package licenses accepted.======] 100% Computing updates...             

使用sudo和上面的命令得到

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:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 5 more

附加错误日志

File /opt/android-sdk-linux/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.3 in /opt/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 26 in /opt/android-sdk-linux/licenses
Warning: License for package Android SDK Platform 26 not accepted.

我不知道为什么它检查许可证,当我的sdk位置是其他


当前回答

在Mac OS 10.15.1上,即使通过运行sdkmanager—licenses接受了所有许可证,我也得到了相同的错误。Bash_profile到下面

export ANDROID_HOME=/Users/your_username/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:~/Library/Android/sdk/platform-tools

并重新加载~/.bash_profile

source ~/.bash_profile 

其他回答

在我的情况下,我只是在一台新的笔记本电脑上安装了一个新版本的android studio,并克隆了旧的存储库 buildToolsVersion“30.0.2”在应用程序级别build.gradle。 我刚刚升级到30.0.3,这是android工作室自己推荐的,问题就消失了

如果您正在使用颤振,请执行以下步骤

1.open the command prompt

然后执行以下命令

2.C:\Users\niroshan>flutter doctor

您将看到如下问题

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.17763.1339], locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    X Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.50.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

实际上,您必须运行下面的命令

C:\Users\niroshan>flutter doctor --android-licenses

如果您在使用Flutter时出现此错误,请在命令提示符上运行以下命令。

flutter doctor --android-licenses

如果运行上述命令后出现以下错误

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)

然后请执行以下步骤

开放android工作室 进入SDK管理器 单击SDK工具选项卡 安装Android SDK命令行工具 再运行一下颤振医生机器人执照

您可以通过进入SDK管理器(设置>[搜索Android SDK]),然后找到错误消息中指出的包,并在那里找到它们,从而接受上述SDK的许可协议。很有可能,您会发现没有完全安装的sdk,并且在安装它们时会要求您接受许可协议。

在28.0.3版本使用带有构建工具的android-28;或者版本26.0.3的构建工具。

或者试试这个:yes | sudo sdkmanager—licenses