Automatically accept all SDK licences

后端 未结 30 1765
感情败类
感情败类 2020-11-22 16:35

Since gradle android plugins 2.2-alpha4:

Gradle will attempt to download missing SDK packages that a project depends on

Which

相关标签:
30条回答
  • 2020-11-22 17:14

    This path has been changed in the recent versions. ./sdkmanager is now in /Library/Android/sdk/cmdline-tools/latest/bin and then just do

    ./sdkmanager --licenses
    
    0 讨论(0)
  • 2020-11-22 17:15

    If you use tools/bin/sdkmanager --licenses you still need to have a human interaction. I have the problem using my gitlab CI. This is my solution:

    wget --quiet --output-document=tools.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
    unzip -qq tools.zip
    echo y | tools/bin/sdkmanager "platforms;android-25"
    echo y | tools/bin/sdkmanager "platform-tools"
    echo y | tools/bin/sdkmanager "build-tools;25.0.2"
    echo y | tools/bin/sdkmanager "extras;android;m2repository"
    echo y | tools/bin/sdkmanager "extras;google;m2repository"
    

    echo y will say yes if there is any question, but you need to make one line per installe package

    0 讨论(0)
  • 2020-11-22 17:15

    In Windows PowerShell, you can do

    for($i=0;$i -lt 30;$i++) { $response += "y`n"}; $response | sdkmanager --licenses
    

    This is much more flexible and requires zero manual intervention. The 30 number is arbitrary, should be enough to cover the number of license acceptances, but can be increased if needed

    0 讨论(0)
  • 2020-11-22 17:16

    I solved this problem by creating a public git repo with the accepted license files. Then I use wget to fetch these licenses on any machine I need into a [sdk-dir]/licenses directory before running ./gradlew to build my project.

    0 讨论(0)
  • 2020-11-22 17:18

    I tried all the above command on windows 10 machine but the solution was to use the SDKMANAGER to check and accept licenses buy installing missing versions

    0 讨论(0)
  • 2020-11-22 17:19

    Note: This is only for Mac users

    I had same issue but none of the answers posted helped since there was no tools folder present in Library/Android/sdk. (I'm using Android 3.6.3 on Mac OS 10.14.4)

    Below steps helped me to overcome licensing problem error:

    1. Open Android Studio
    2. Press cmd + shift + A. This opens Actions pop-up window.
    3. Search for SDK Manager and hit enter to open.
    4. This opens pop-up for Android SDK. Select some other version of Android apart from already installed one. (In my case Android 10.0 was already installed so I selected Android 9.0)
    5. Then select Apply button. This will install corresponding SDK.

    1. Now run your app it should work without any exception.

    0 讨论(0)
提交回复
热议问题