经过几个小时的挣扎,我能够设置我的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
但是,当我在我的bild.gradle文件中使用“com.google.android.gms:play-services-location:11.0.2”时,我最终收到此错误:
FAILURE:构建因异常而失败 . *出了什么问题:无法解析所有配置文件':app:debugRuntimeClasspath' . 找不到com.google.android.gms:play-services-location:11.0.2 . 在以下位置搜索:file:/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
任何帮助深表感谢 .
2 回答
试试这个,它对我来说很好 .
我认为这是因为您使用的是gms库,但不包括google maven repo到您的gradle脚本 .
谷歌已经发布了自己的回购(https://developer.android.com/studio/build/dependencies.html#google-maven),you,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,下载时间要少得多 .