CircleCI-Public / cimg-android

The CircleCI Android Docker Convenience Image.
MIT License
72 stars 37 forks source link

Install default build-tools version for AGP 7.3.0 #59

Closed seadowg closed 1 year ago

seadowg commented 1 year ago

I'm assuming this image is optimized for projects using AGP 7.3.0, but the current build-tools being installed (30.0.0) is not the default for that plugin version. This means that the default build tools version (30.0.3) gets installed during Android compilation tasks (./gradle assembleDebug for example).

FelicianoTech commented 1 year ago

Hi. Thank you for the PR.

As mentioned in the readme, edits to this image should be applied to the Dockerfile.template file. Then, during the next release the changes will be published. We don't edit generated Dockerfiles directly.

Would you be able to make these changes?

seadowg commented 1 year ago

As mentioned in the readme, edits to this image should be applied to the Dockerfile.template file. Then, during the next release the changes will be published. We don't edit generated Dockerfiles directly.

Oooooft sorry that's a bad miss on my part. I'll fix that.

seadowg commented 1 year ago

@felicianotech done!

seadowg commented 1 year ago

@felicianotech this is still a problem in the latest (v2022.12.1) release

JalexChen commented 1 year ago

hey @seadowg - I don't think the build is actually optimized for AGP. this is something that's typically associated with Android Studio, which isn't installed on this image

Can you let us know which image you are using where you are seeing this information? build-tools;30.0.0 does not exist even on the earliest image with the 2021.08 tag

that said, build-tools;33.0.3 does not exist - the latest version is what is installed on the image (build-tools;33.0.1). the only version of 33.0.3 that exists would be platform-tools, which is also what is currently installed in the most up-to-date images

If you need to use the latest versions, this can be specified through the buildToolsVersion option in your build.gradle file per the docs, which would override the default/installed.

Please re-open if you don't think this is resolved

seadowg commented 1 year ago

I don't think the build is actually optimized for AGP. this is something that's typically associated with Android Studio, which isn't installed on this image

As far as I'm aware, anyone compiling an Android project with Gradle will (usually) be using AGP regardless of whether they're using Android Studio or not. I think otherwise you'd have to deal with the build and platform tools directly to create an APK (or App Bundle), run androidTest tests etc. The reason I'd assumed the image was optimized for AGP 7.3.0 is that it was the latest release at the time I submitted the PR. Each AGP has a default build tools version that it will use unless the project has a specified buildToolsVersion (as you point out). When the project is compiled the AGP will fetch the specified version of build tools (or the default) if it's not installed already. My goal with this PR was to make sure that the default version 30.0.3 was pre-installed to prevent that extra work. It does feel to me that if this image is optimized for Gradle Android projects (which I'm assuming it is but could be wrong about), then having the default tooling for the latest AGP pre-installed is helpful.

Can you let us know which image you are using where you are seeing this information? build-tools;30.0.0 does not exist even on the earliest image with the 2021.08 tag

that said, build-tools;33.0.3 does not exist - the latest version is what is installed on the image (build-tools;33.0.1). the only version of 33.0.3 that exists would be platform-tools, which is also what is currently installed in the most up-to-date images

Oh, wow I'd got myself very confused by confusing the 33.0.x in the Dockerfile for 30.0.x 😔. According to AGP docs, Build Tools 30.0.3 is the default version for AGP 7.4.0 (and the previous 7.3.0 release). I can confirm that from our build logs in Circle CI using cimg/android:2022.12.1 as we see the following as part of ./gradlew assembleDebug:

Checking the license for package Android SDK Build-Tools 30.0.3 in /home/circleci/android-sdk/licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" ready.
Installing Android SDK Build-Tools 30.0.3 in /home/circleci/android-sdk/build-tools/30.0.3
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" complete.
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" finished.

If there is agreement that having the default version of Build Tools pre-installed on the image is a good thing, then I can reopen the PR and fix my mistake of just switching from 33.0.0 to 33.0.3 (rather than making sure build-tools 30.0.3 is installed).

seadowg commented 1 year ago

This is still a problem for the newest 2023.03.1 release, which installs version 34.0.0-rc2 of Build Tools rather than the current default of 30.0.3.

ryanbourdais commented 1 year ago

Hi @seadowg this latest release features the usage of build-tools;34.0.0-rc2 because it is required to support the Android 14 Preview. This convenience image is maintained with the goal to have the most up-to-date versions of each technology used, but if you would like to use a different version of build-tools you can either install it using the sdkmanager or try an older version of the image.

seadowg commented 1 year ago

Hi @seadowg this latest release features the usage of build-tools;34.0.0-rc2 because it is required to support the Android 14 Preview. This convenience image is maintained with the goal to have the most up-to-date versions of each technology used

That makes a lot of sense to me! I still think it would be beneficial to also include the current default version (which I imagine is what most people will be using), but I understand wanting to just include one.