0
votes

After struggling for a couple of hours I was able to setup my docker container. My yml file is as below:

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

However, when I use 'com.google.android.gms:play-services-location:11.0.2' in my bild.gradle file I end up receiving this error:

FAILURE: Build failed with an exception. * What went wrong: Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not find com.google.android.gms:play-services-location:11.0.2. Searched in the following locations: file:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom file:/opt/android-sdk/extras/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar file:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom file:/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.jar file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/11.0.2/play-services-location-11.0.2.pom file:/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 Required by: project :app > project :sdk

Any help is much appreciated.

2
Please help!!!!Orkhan Gasimli

2 Answers

4
votes

Try this, it builds fine for me.

image: mingc/android-build-box:latest

pipelines:
  default:
  - step:
      script:
        - chmod +x gradlew
        - ./gradlew assemble
0
votes

I think it's because you are using the gms libs, but not include google maven repo to your gradle script.

Google has published their own repo(https://developer.android.com/studio/build/dependencies.html#google-maven),you can add it to your project.

Please kindly check your build.gradle and add google() (if you are using android gradle plugin 3.0) or

maven { url "https://maven.google.com" } into

allprojects { repositories { ... } }

section.

BTW in most cases a tiny android sdk docker is enough for CI pipeline, maybe you can try https://hub.docker.com/r/zhywang/android-sdk/ , it's just ~700MB, takes much less time to download.