Android Build工具26.0.2不接受许可

时间:2017-11-29 03:40:48

标签: android jenkins build-tools

我向Jenkins上传了一个新项目,其中compileSdkVersion为26,targetSdkVersion为25.我已使用以下命令接受了sdk的所有许可证:

 ./sdkmanager --licenses

一切都在我的电脑上运行良好,但是当我在Jenkins上构建时,它会抛出错误:

Starting a Gradle Daemon (subsequent builds will be faster)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'testCompile' in project ':app' is deprecated. Use'testImplementation' instead.
Configuration 'provided' in project ':app' is deprecated. Use 'compileOnly' instead.
Checking the license for package Android SDK Build-Tools 26.0.2 in 
/Users/Shared/Jenkins/Library/Android/sdk/licenses

Warning: License for package Android SDK Build-Tools 26.0.2 not 
accepted.
Checking the license for package Android SDK Platform 26 in 
/Users/Shared/Jenkins/Library/Android/sdk/licenses
Warning: License for package Android SDK Platform 26 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK 
components:
 [Android SDK Platform 26, Android SDK Build-Tools 26.0.2].

我运行了相同的命令来接受Jenkins机器上的许可证,它说所有许可证都已被接受。我不确定会出现什么问题。

有人可以帮忙吗?

由于

3 个答案:

答案 0 :(得分:1)

我能够解决这个问题。实际问题是缺少具有android sdk路径的local.properties文件

答案 1 :(得分:0)

我相信你的目标SDK也应该是26

答案 2 :(得分:0)

您可能已接受SDK API的许可,但构建工具位于第二个选项卡中。从Android Studio打开它,确保覆盖所有选项卡,而不仅仅是第一个选项卡。

要从AS查找SDK Manager,请转到文件,设置,Appereance&行为,系统设置,Android SDK。查看说明SDK工具的第二个选项卡。