开发项目时,碰到持续集成工具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文件中对应发布的阶段版本,是不是你最新的版本,无误后,然后重新上传代码。