Build failing to install missing Android Tools

Bitrise Build Issue Report template

Description of the issue

Build is failing at the step where it installs missing Android tools

Searching for missing SDK components using:
$ ./gradlew “dependencies”
Failed to find missing components, retrying…

Environment:

Where did the issue happen?

Assume its Bitrise stack - this build was successful started failing on March 2 nd

Which build Step causes the issue and which version of the step?

(4) install missing Android tools

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : Between 12:00 and 14:50 Melbourne AU time

Local reproduction

Builds ok with Android studio

Build log

Hi @Stephen_Franklin,

Thanks for creating this #issues:build-issues report!

From the build’s log:

FAILURE: Build failed with an exception.

* Where:
Script '/bitrise/src/X/bintray.gradle' line: 60

* What went wrong:
A problem occurred evaluating script.
> /bitrise/src/local.properties (No such file or directory)

It seems you have a dependency which requires auth to be specified in local.properties (this file is usually git ignored, exactly because you specify private infos in it and so it should not be in the repo).

Local reproduction:

  1. Please do a clean git clone of the repo, into a new directory on your Mac/PC
  2. Then try to run a build from there

You’ll get the same error.

Solution:

Generate that local.properties file before any Gradle command during the build, e.g. right before the install-missing-android-tools.

There are many ways to do this, probably the easiest is to use a Script step and just generate the file there. Checking your log you already have a Script step (title: Do anything with Script step) right before this step, so you don’t even have to add one.

Simply specify this as the Script:

#!/usr/bin/env bash

echo 'Generating local.properties ...'

cat > "./local.properties" <<- FILE_CONTENT
Line 1.
Line 2.
FILE_CONTENT

Simply replace Line 1, Line 2 with the lines to write into the file. The file’s content is defined between the two FILE_CONTENT text.

E.g. it can be something like

bintray.user=your_bintray_user_name
bintray.apikey=your_bintray_api_key

It’s probably a good idea to NOT to include the private infos in the config / script directly, so a more advanced Script would be something like:

#!/usr/bin/env bash

echo 'Generating local.properties ...'

cat > "./local.properties" <<- FILE_CONTENT
bintray.user=MyBinTrayUser
bintray.apikey=$BINTRAY_API_KEY
FILE_CONTENT

and then specify BINTRAY_API_KEY as a Secret in the workflow editor. This way your config will only include the placeholder ($BINTRAY_API_KEY), and it will be replaced during the build with the value you specify in Secrets.

If you’d have any questions just let us know! :slight_smile:

1 Like

same issue faced by me today, got error msg like :-
A problem occurred configuring root project ‘src’.

Could not resolve all artifacts for configuration ‘:classpath’.
Could not find com.google.gms:google-services:4.0.1.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
Required by:
project :

Hy there!
could you try adding this line to the build.gradle file’s repositories field?
maven { url 'https://dl.bintray.com/android/android-tools/' }