Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,621
Community Members
 
Community Events
184
Community Groups

Bitbucket pipeline fails for gradle 8.0 and JAVA 17

Pankaj Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 28, 2023
Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
21
Your current JDK is located in /usr/lib/jvm/java-11-openjdk-amd64
Bitbucket pipeline config file :
+image: amazoncorretto:17 // to build docker image with java 17
 pipelines:
   pull-requests:
     '**':
       - step:
           size: 2x
           name: Unit Tests
           image: androidsdk/android-31:latest
           script:
             - chmod +x gradlew
             - ./gradlew app:testCompanionDevDebugUnitTest fleetlib:testDevDebugUnitTest --no-daemon
           artifacts:
             - app/build/reports/tests/testCompanionDevDebugUnitTest/

2 answers

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 01, 2023

Hi @Pankaj Kumar and welcome to the community!

I can see in your bitbucket-pipelines.yml file that you define an image both at the top (image: amazoncorretto:17) and also on the step level (image: androidsdk/android-31:latest). When you specify an image in both places, then the image defined on the step level will be used, in this case, androidsdk/android-31:latest. This Docker image has Java 11.

You can see the version locally if you have Docker installed on your computer. You can run the command

docker run -it --entrypoint=/bin/bash androidsdk/android-31:latest

In the bash prompt of the container that starts, you can run the command

java --version

You can check this way the version of tools in any other Docker image, by replacing androidsdk/android-31:latest with a different Docker image.

I see that the image amazoncorretto:17 has indeed Java 17, so if you want to use this image instead, you will need to remove the Docker image definition (image: androidsdk/android-31:latest) from the step level.

Make sure that the image definition at the top doesn't have the + sign at the beginning and the part "// to build docker image with java 17" (you can add a comment with the symbol # instead of //)

Kind regards,
Theodora

Pankaj Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 03, 2023

Thanks @Theodora Boudale  , for your response. This has been resolved now.

Like Theodora Boudale likes this

Hi @Pankaj Kumar 

How did you manage to resolve this issue? Did you find image that works? I tried to use amazoncorretto:17 image, but then I get error: 

-----
What went wrong: Could not determine the dependencies of the task ':app:testDebugUnitTest'. > SDK location not found. Please define a valid SDK location by setting the ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local.properties file located at '/opt/atlassian/pipelines/agent/build/local.properties'.
-----

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2023

Hi @JokerKK ,

The error message you see indicates that the build cannot find the Android SDK. It looks like the Android SDK is not pre-installed in amazoncorretto:17 image.

You will need to either use a different existing image that has the tools you need pre-installed or build your own custom image. We support public and private Docker images including those hosted on Docker Hub, AWS, GCP, Azure, and self-hosted registries accessible on the internet.

Another option would be to install the Android SDK during the build.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events