Android開發筆記-License for package Android SDK Platform 28 not accepted

  開發項目時,碰到持續集成工具CircleCI上報了一個Android SDK異常,如下:

> Configure project :app
useNewCruncher has been deprecated. It will be removed in a future version of the gradle plugin. New cruncher is now always enabled.
useNewCruncher has been deprecated. It will be removed in a future version of the gradle plugin. New cruncher is now always enabled.
Checking the license for package Android SDK Platform 28 in /opt/android/sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
  
  Using Android SDK: /opt/android/sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 37s

解決辦法:

    1.1 檢查項目中的版本當前是27,改成28(注意如果有多個component是27的,建議一個一個的改,然後build,如果全部一塊改了,然後build,很可能不成功,實測驗證)

1.2 安裝對應的證書,找到安裝SDK的路徑如:\AppData\Local\Android\Sdk\tools\bin>,cmd後執行:
  sdkmanager --licenses
  一路點擊 yes

你可能遇到:
  .android\repositories.cfg could not be loaded

解決辦法:在.android目錄下新建一個repositories.cfg 文件

1.3 檢查.yml文件中對應發佈的階段版本,是不是你最新的版本,無誤後,然後重新上傳代碼。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章