How to setup for Android?

Current setup:

image: java:8

    - step:
        script: # Modify the commands below to build your repository.
          - ./gradlew build

I am getting this warning: `SDK location not found. Define location with sdk.dir in the file or with an ANDROID_HOME environment variable.`

It does not make sense to edit the file, because that will ruin the project on my local pc. What am I supposed to do?

1 answer

0 vote

I'm not very familiar with android development, but have you tried defining the environment variable mentioned in the error message? Eg. with a line like this at the beginning of your script:

- export ANDROID_HOME=...

If that doesn't work then an alternative would be to create or overwrite the file in your script. For example you could add a file "" to your repo and then copy it to "" at the beginning of your script:

- cp


I managed to solve this by manually downloading the Android SDK and creating the

One last question: is it possible to keep the Android SDK on the server? It seems like a waste of bandwidth for Bitbucket having to download the full SDK every time I commit my code.

Joshua Tjhin Atlassian Team Oct 19, 2016

Interesting. Could you share your bitbucket-pipelines.yml?

To avoid downloading the Android SDK every time you'll need to use a docker image that already has it installed (instead of the "java:8" image). You should see if you can find a public image that someone else has already built (keeping in mind that it needs to have gradle too) or you can build one yourself that has all the tools you need.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

171 views 20 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you