I'm utilizing the gitlab auto devops android template Android.gitlab-ci.yml here but it's using a java 8 image (whereas I want to use java 11). Also, it has ANDROID_COMPILE_SDK set to "29" and I want to compile my app with the latest version - currently 31.

1

There are 1 best solutions below

0
On BEST ANSWER

There is another "latest" template file named Android.latest.gitlab-ci.yml which can be found on gitlab here . At time of writing it sets image to "openjdk:11-jdk" and COMPILE_SDK to "30". See relevant gitlab MR/discussion for more context.

So, if you just want to use whatever is in the template, your .gitlab-ci.yml just needs to look like this:

include:
  - template: Android.latest.gitlab-ci.yml

That's all you need.

At time of writing that sets ANDROID_COMPLE_SDK to "30". So, if you want to bump that up and set it yourself, it's as simple as adding it to that file. For instance:

include:
  # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.latest.gitlab-ci.yml
  - template: Android.latest.gitlab-ci.yml

variables:
  ANDROID_COMPILE_SDK: "31"
  ANDROID_BUILD_TOOLS: "31.0.0"

Just remember that if/when someone updates the template to say, "32", you'll still be using "31". The choice is yours:

  • Don't set any values (only use the include) and you'll get the update automatically when someone updates the template
  • Do set/override some values. Updates won't be automatic, so you'll have to be sure to maintain them yourself