Android CI using Bitbucket Pipelines and Docker(使用 Bitbucket Pipelines 和 Docker 的 Android CI)
问题描述
我正在尝试在 Android 的 Bitbucket Pipelines 中设置持续集成 (CI).
I am trying to set up Continuous Integration (CI) in Bitbucket Pipelines for Android.
我使用 Android Studio 2.1.1 创建了一个示例空白活动.
I have created a sample blank activity using Android Studio 2.1.1.
对于 Pipelines,我使用的是 uber/android-build-environment Docker 容器很好地创造了环境.这是我的 bitbucket-pipelines.yml
With Pipelines I'm using the uber/android-build-environment Docker container which creates the environment nicely. Here is my bitbucket-pipelines.yml
image: uber/android-build-environment:latest
pipelines:
default:
- step:
script:
- echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a # Grab the Android Support Repo which isn't included in the container
- ./gradlew assembleDebug
需要进行一些更改,因为 uber/android-build-environment 预计会像这样运行:
Some changes are needed since uber/android-build-environment is expecting to be run like so:
docker run -i -v $PWD:/project -t uber/android-build-environment /bin/bash /project/ci/build.sh
例如,源不是复制到卷 /project
而是 Pipelines 将 Bitbucket repo 的内容复制到容器的工作目录:
For example, the source is not copied to the volume /project
but instead Pipelines copies the contents of the Bitbucket repo to the working directory of the container at:
/opt/atlassian/bitbucketci/agent/build
当 ./gradlew assembleDebug
运行时,我收到以下错误:
And when ./gradlew assembleDebug
is run I get the following error:
...
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type TaskArtifactStateCacheAccess using TaskExecutionServices.createCacheAccess().
> Failed to create parent directory '/opt/atlassian/bitbucketci/agent/build/.gradle' when creating directory '/opt/atlassian/bitbucketci/agent/build/.gradle/2.10/taskArtifacts'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 56.449 secs
在工作目录中运行 ls -al
给出:
Running ls -al
in the working directory gives:
ls -al
total 52
drwxr-xr-x 5 root root 4096 May 31 22:33 .
drwxr-xr-x 3 root root 4096 May 31 22:43 ..
drwxr-xr-x 3 root root 4096 May 31 22:33 app
-rw-r--r-- 1 root root 462 May 31 22:33 bitbucket-pipelines.yml
-rw-r--r-- 1 root root 498 May 31 22:33 build.gradle
drwxr-xr-x 8 root root 4096 May 31 22:33 .git
-rw-r--r-- 1 root root 387 May 31 22:33 .gitignore
drwxr-xr-x 3 root root 4096 May 31 22:33 gradle
-rw-r--r-- 1 root root 855 May 31 22:33 gradle.properties
-rwxr-xr-x 1 root root 4971 May 31 22:33 gradlew
-rw-r--r-- 1 root root 2314 May 31 22:33 gradlew.bat
-rw-r--r-- 1 root root 15 May 31 22:33 settings.gradle
推荐答案
这是他们系统中的一个错误,我报告它(issue url,这很长)给他们,他们已经修复了它(fix url).我已经对我的项目进行了测试,它成功构建了.现在尝试构建你的项目,祝你好运.
It's a bug in their system , I report it(issue url, it's quite long) to them and they have fixed it (fix url).I have tested on my project and it successfully build.Try to build your project now and good luck.
这篇关于使用 Bitbucket Pipelines 和 Docker 的 Android CI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Bitbucket Pipelines 和 Docker 的 Android CI
基础教程推荐
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01