Failed to install the following Android SDK packages as some licences have not been accepted in jitpack

梦想的初衷 提交于 2019-12-20 10:21:13

问题


I am getting this error in jitpack, I've tried everything on the internet. Below is my error

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.

And when i run ./sdkmanager --licenses

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

Using sudo with the above command gives

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

additional error log

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.

I don't know why it's checking for licenses there when my sdk location is other


回答1:


You need to accept the licences before building.

According to Android SDK docs you can use the following command depending on the sdkmanager location: Docs on --licenses option seems to be missing though.

yes | sdkmanager --licenses

Ubuntu : yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses

macOS : yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

Windows: %ANDROID_HOME%/tools/bin/sdkmanager --licenses




回答2:


in Windows OS go to your sdkmanager path then execute

./sdkmanager.bat --licenses

You can find your sdkmanager in C:\Users\USER\AppData\Local\Android\Sdk\tools\bin

To find your actual android SDK path follow the red marked area of the below picture




回答3:


For Windows I ran the following for a platform;android-28 error

C:\Android\sdk\tools\bin> .\sdkmanager.bat "platforms;android-28"

and then agree to the licence




回答4:


use android-28 with build-tools at version 28.0.3; or build-tools at version 26.0.3.

or try this: yes | sudo sdkmanager --licenses




回答5:


This works for me:

yes | ./sdkmanager "platforms;android-28"

yes | ./sdkmanager "build-tools;28.0.3"

yes | ./sdkmanager --licenses




回答6:


If you are working with Flutter then this command would definitely work for you.

flutter doctor --android-licenses



回答7:


Appears to be a bug at the momment: https://issuetracker.google.com/issues/123054726

Solution that worked for me:

Create a .travis.yml file in your project directory and copy these lines:

before_script:
- mkdir "$ANDROID_HOME/licenses" || true
- echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"

Reference: https://github.com/square/RxIdler/pull/18/files




回答8:


I used the following:

  • set the route of sdk> AppData\Local\Android\Sdk\tools\bin>
  • run .\sdkmanager.bat --licenses



回答9:


I noticed that in Windows, your console must be opened as administrator. Otherwise it won't consider you've accepted the licenses.



来源:https://stackoverflow.com/questions/54273412/failed-to-install-the-following-android-sdk-packages-as-some-licences-have-not-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!