Android SDK location for local.properties

Description of the issue

I have an issue where my project builds locally (via Android Studio and gradle) but fails on Bitrise with the error below:

> Task :unityLibrary:BuildIl2CppTask FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/bitrise/src/android/unityLibrary/build.gradle' line: 51
* What went wrong:
Execution failed for task ':unityLibrary:BuildIl2CppTask'.
> java.io.FileNotFoundException: /bitrise/src/android/unityLibrary/local.properties (No such file or directory)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':unityLibrary:BuildIl2CppTask'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)

This happens because there is a step in our project where the embedded Unity project is looking for a “local.properties” file. I know this file is created on each user’s machine and is usually ignored in Github, so that’s why Bitrise can’t find the file after it checks out our code from Github.

I used the advice here (Build failing to install missing Android Tools) to create a script that creates a local.properties on Bitrise. The problem is that the embedded Unity project is looking for a specific value in that local.properties file. It’s looking for “sdk.dir” with the value being the file location of the Android SDK Bitrise is using. I am unsure what value to plug in for Bitrise. Is there a place somewhere that outputs the Android SDK location used on Bitrise so I can plug it in the local.properties file I’m making? I didn’t find anything in the “Install missing Android SDK components” step.

Environment:

Where did the issue happen?

Android & Docker, on Ubuntu 20.04

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

Gradle Runner 2.0.1

Reproducibility

Happens every build

Local reproduction

Builds ok with Android studio

Hey @asvitzer thanks for reporting! We’re discussing this issue privately, but figured it could be useful for someone finding this thread later to know that you can use the $ANDROID_HOME variable to point to the SDK location on any given environment.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.