经过几个小时的挣扎,我能够设置我的docker容器。我的yml文件如下:
image: mingc/android-build-box:latest
pipelines:
default:
- step:
script:
# Grab the Android Support Repo which isn't included in the container
- echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a
# Accept preview licences
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_SDK_HOME/licenses/android-sdk-preview-license"
- ./gradlew assembleDebug --info
但是,当我使用com.google.android.gms:play-services-location:11.0.2'在我的bild.gradle文件中,我最终收到此错误:
失败:构建因异常而失败。 *出了什么问题:无法解析配置的所有文件':app:debugRuntimeClasspath'。 找不到com.google.android.gms:play-services-location:11.0.2。 在以下位置搜索: 文件:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom 文件:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar 文件:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom 文件:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar 文件:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom 文件:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar https://jcenter.bintray.com/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom https://jcenter.bintray.com/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar https://jitpack.io/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom https://jitpack.io/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar 要求: 项目:app>项目:sdk
非常感谢任何帮助。
答案 0 :(得分:1)
试试这个,它对我来说很好。
image: mingc/android-build-box:latest
pipelines:
default:
- step:
script:
- chmod +x gradlew
- ./gradlew assemble
答案 1 :(得分:0)
我认为这是因为您使用的是gms库,但不包括google maven repo到您的gradle脚本。
Google已发布了自己的仓库(https://developer.android.com/studio/build/dependencies.html#google-maven),you可以将其添加到您的项目中。
请检查您的build.gradle并添加
google()
(如果您使用的是android gradle plugin 3.0)或
maven {
url "https://maven.google.com"
}
进入
allprojects {
repositories {
...
}
}
部分。
BTW在大多数情况下,一个小的android sdk docker足够用于CI管道,也许你可以尝试https://hub.docker.com/r/zhywang/android-sdk/,它只需要700MB,下载的时间要少得多。