mreichelt / docker-android

Docker images for Android development
MIT License
74 stars 11 forks source link

License acceptance #17

Closed sonOfRa closed 4 years ago

sonOfRa commented 4 years ago

Hi,

first off: I'm not sure if this issue is even related to the docker image, but it might be, so I'm opening it here.

Since we upgraded the android gradle-plugin to version 3.4.x, it started complaining about us not having accepted licenses. The licenses are accepted in the docker images, so we're wondering if something changed. Our GitLab-CI file looks like this:

image: mreichelt/android:28-system

variables:
  GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradlehome"
  ANDROID_SDK_ROOT: "$ANDROID_HOME"
  M2_HOME: "$CI_PROJECT_DIR/.m2"
  GIT_SUBMODULE_STRATEGY: "normal"

cache:
  paths:
  - "$GRADLE_USER_HOME/caches/modules-2"
  - "$GRADLE_USER_HOME/wrapper"
  - "$M2_HOME"

before_script:
- chmod +x ./gradlew
- mkdir -p "$GRADLE_USER_HOME"
- mkdir -p "$M2_HOME/conf"
- cp wi-android-global/mvn/settings.xml.example "$M2_HOME/settings.xml"
- cp wi-android-global/gradle/settings.gradle.example "$M2_HOME/conf/settings.gradle"

stages:
- build
- test

build:
  stage: build
  script:
  - ./gradlew --no-daemon assembleRelease
  artifacts:
    paths:
    - app/build/
    - .gradle/

unitTests:
  stage: test
  script:
  - ./gradlew --no-daemon testReleaseUnitTest
  - ./gradlew jacocoTestReleaseUnitTestReport

  after_script:
  - mv app/build/reports/tests/testReleaseUnitTest unit-test
  - grep -Eo "Total.*?([0–9]{1,3})%" app/build/reports/jacoco/jacocoTestReleaseUnitTestReport/html/index.html

  artifacts:
    reports:
      junit: app/build/test-results/testReleaseUnitTest/TEST-*.xml

    paths:
    - unit-test
    - app/build/reports

    expire_in: 30 days
    when: always

Now, on build, gradle first presents this warning:

File /root/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.3 in /builds/mobile/wi-android-pos-app/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /builds/mobile/wi-android-pos-app/licenses
Warning: License for package Android SDK Platform 28 not accepted.

And subsequently fails the build with:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28

Are you aware of any changes that need to be made (either to our ci-build or to the docker image) to work correctly with the 3.4 gradle plugin and above?

sonOfRa commented 4 years ago

So I copied the /opt/android/licenses folder into the location it is checking, and now it downloads the whole toolchain into the build directory:

Checking the license for package Android SDK Build-Tools 28.0.3 in /builds/mobile/wi-android-pos-app/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in /builds/mobile/wi-android-pos-app/build-tools/28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.
Checking the license for package Android SDK Platform 28 in /builds/mobile/wi-android-pos-app/licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
"Install Android SDK Platform 28 (revision: 6)" ready.
Installing Android SDK Platform 28 in /builds/mobile/wi-android-pos-app/platforms/android-28
"Install Android SDK Platform 28 (revision: 6)" complete.
"Install Android SDK Platform 28 (revision: 6)" finished.
Checking the license for package Android SDK Platform-Tools in /builds/mobile/wi-android-pos-app/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 29.0.2)".
"Install Android SDK Platform-Tools (revision: 29.0.2)" ready.
Installing Android SDK Platform-Tools in /builds/mobile/wi-android-pos-app/platform-tools
"Install Android SDK Platform-Tools (revision: 29.0.2)" complete.
"Install Android SDK Platform-Tools (revision: 29.0.2)" finished.

Any ideas what could be causing this?

sonOfRa commented 4 years ago

Once again, an android build error that more or less magically disappears after we left it alone for a few months.