在Azure Pipelines的Ubuntu代理上构建Android项目时,SDK目录不可写 [英] SDK directory is not writable when building Android project on Ubuntu agent of Azure Pipelines

查看:89
本文介绍了在Azure Pipelines的Ubuntu代理上构建Android项目时,SDK目录不可写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Android项目配置构建管道.到目前为止,我所有的步骤都可以在Hosted VS2017代理上完美运行,包括获取代码,使用gradlew进行构建,发布工件并将其部署到AppCenter.

I'm configuring my build pipeline for an Android project. So far, all of my steps are working perfectly on Hosted VS2017 agent, including fetching the code, building with gradlew, publishing the artifact and deploying it to AppCenter.

但是,在托管的Ubuntu 1604上,gradlew步骤存在一些问题.

However, on Hosted Ubuntu 1604, there are a few problems with gradlew step.

在VS2017代理上,它仅适用于:.\ gradlew assembleDebug

On VS2017 agent, this works with just: .\gradlew assembleDebug

在Ubuntu 1604上,这就是我现在所拥有的:

On Ubuntu 1604, this is what I'm having right now:

chmod 775 gradlew
chmod 775 /usr/local/lib/android/sdk --> The fix I'm working on
./gradlew assembleDebug

在没有第二行的情况下运行构建,代理将抛出此异常:

Running the build without the 2nd line, agent will throw this exception:

出了什么问题:配置项目':app'时出现问题.
无法安装以下SDK组件:构建工具; 28.0.3 Android SDK构建工具28.0.3
SDK目录不可写(/usr/local/lib/android/sdk)

我是Ubuntu的初学者...为什么它不可写?我尝试进行 chmod ,但是这样做却出现异常: chmod:更改'/usr/local/lib/android/sdk'的权限:不允许操作.

I'm a beginner with Ubuntu... why is it not writable? I tried to chmod but I got the exception while doing so: chmod: changing permissions of '/usr/local/lib/android/sdk': Operation not permitted.

我现在应该朝哪个方向解决这个问题...?预先谢谢大家!

Which direction should I look at to solve this problem now... ? Thank you all in advance!

推荐答案

更改Android SDK的所有权:

Change the ownership of Android SDK:

sudo chown -R $(whoami) $ANDROID_HOME

这篇关于在Azure Pipelines的Ubuntu代理上构建Android项目时,SDK目录不可写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆