How to create local.properties for android project in jenkins?
Asked Answered
H

2

6

We have an android project for an application, it builds without any error on our local machines. Recently had to configure jenkins for the same.

Every time we run the job the BUILD FAILED. Looking for the solution to the error we got to know that the local.properties is missing in the jenkins jobs workspace of our project.

Usually this file is created locally by Android Studio. Is there any way to get this done using gradle commands or code changes? For our jenkins sdk.dir = "/var/lib/jenkins/tools/android-sdk"

Thanks

Heterodyne answered 22/12, 2015 at 3:36 Comment(0)
A
10

A simple hack - Try echoing the path to a file using shell at the same job before using any gradle command as :-

echo "<path to the sdk on jenkins" >> local.properties
Acme answered 3/7, 2016 at 6:28 Comment(0)
O
2

You need to install a plugin to create this configuration file. For example, you can use this: https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin.
But the main problem is that your local.properties file will be in another folder, so your gradlew execution won't be able to find it.

Another solution is to setup your Jenkins System configuration, adding an environment variable ANDROID_HOME and the value is path\to\your\sdk

Ody answered 2/2, 2016 at 18:45 Comment(1)
this didn't help me sort out the problemHeterodyne

© 2022 - 2024 — McMap. All rights reserved.