- step: name: Test caches: - gradle image: bitbucketpipelines/android-ci-image script: - ./gradlew test
In another project this worked before with another image, but that image is no longer available so i tried it with the official bitbucketpipelines/android-ci-image.
Now I get the following error. Should the image work with my configuration? Do I anything wrong? Relevant parts of Gradle files also following:
Welcome to Gradle 8.2.1!
Here are the highlights of this release: - Kotlin DSL: new reference documentation, assignment syntax by default - Kotlin DSL is now the default with Gradle init - Improved suggestions to resolve errors in console output - Reduced sync memory consumption
For more details see https://docs.gradle.org/8.2.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'AppName'. > Could not resolve all files for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:8.1.0. Required by: project : > com.android.application:com.android.application.gradle.plugin:8.1.0 project : > com.android.library:com.android.library.gradle.plugin:8.1.0 > No matching variant of com.android.tools.build:gradle:8.1.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.2.1' but: - Variant 'apiElements' capability com.android.tools.build:gradle:8.1.0 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.2.1') - Variant 'javadocElements' capability com.android.tools.build:gradle:8.1.0 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.2.1') - Variant 'runtimeElements' capability com.android.tools.build:gradle:8.1.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.2.1') - Variant 'sourcesElements' capability com.android.tools.build:gradle:8.1.0 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.2.1')
Top level build.gradle
plugins { id 'com.android.application' version '8.1.0' apply false id 'com.android.library' version '8.1.0' apply false id 'org.jetbrains.kotlin.android' version '1.8.21' apply false id 'com.google.dagger.hilt.android' version '2.45' apply false }
Thank you for reaching out to Atlassian Community!
I'd like to inform you that unfortunately this image doesn't seem to be compatible as the issue you're facing is that the Android Gradle Plugin version 8.1.0 is being requested, but it appears to be incompatible with the Java version being used (Java 8). The error message indicates that the Android Gradle Plugin 8.1.0 expects Java 11, but this image is currently using Java 8.
When I accessed the image, I was able to confirm that it's using Java 8, please see:
docker run -it bitbucketpipelines/android-ci-image /bin/bash Unable to find image 'bitbucketpipelines/android-ci-image:latest' locally latest: Pulling from bitbucketpipelines/android-ci-image 000eee12ec04: Pull complete 2f1dc2bdcfe1: Pull complete c2a806caa98c: Pull complete c5943b75c974: Pull complete 0a99bba8cba5: Pull complete Digest: sha256:ac99647b6ae7de3a54f3849f69a385d2e9130a7601fbe61749a6918bf156225d Status: Downloaded newer image for bitbucketpipelines/android-ci-image:latest root@cccf6b9e88c4:/# java -version openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
As a recommendation I'd like to recommend you to use a different image, which is utilizing Java 11.