Setting up TeamCity to build Android Studio project
Asked Answered
A

2

30

I cannot for the life of me find any reference on the internet for how to setup TeamCity to build Android Studio projects.

I've found links to IntelliJ Idea and TeamCity, to Gradle and TeamCity, but nothing specifically on building an Android Studio project in TeamCity.

Can anyone point me in the right direction?

Assertive answered 3/3, 2015 at 18:37 Comment(1)
-voters. Any comment why you've down voted this? It's a legitimate question, and answer not yet found on SO. SO often deals with team city setup questions.Assertive
A
33

Thanks to Yole's direction, I've set this up now.

The steps if anyone is interested are below:

  1. Install Gradle on the build agent server. I took the gradle-2.3.bin from http://gradle.org/downloads and copied to C:\gradle-2.3
  2. Set the environment variable GRADLE_HOME = C:\gradle-2.3
  3. Install Android Studio on the build agent server. This should also install the Android SDK
  4. Set the environment variable ANDROID_HOME = C:\Users\%Current User%\AppData\Local\Android\sdk
  5. Restart the TeamCity agent server
  6. Setup your build configuration with the Gradle runner, setting Gradle tasks to 'clean build' and setting the Gradle Home path. Set working directory to the project directory for your Android project

Run the build!

enter image description here

Assertive answered 3/3, 2015 at 21:53 Comment(5)
can u pls tell how can i do implementation of TeamCity in Android Studio project ?Terrenceterrene
I thought I did ^ :) You need to ensure you can build your Android project via Gradle. That's the first task and separate to TeamCity. Once you have that you can use the TeamCity Gradle Task Runner to execute your gradle tasks. The only part where we got stuck was configuring the build server with environment variables and SDKs.Assertive
i knw the first part and i have installed TEAMCITY but getting issue for 2nd point can u pls help me @Dr. ABTTerrenceterrene
Trying this on Docker so maybe it's a bit different and I see this is from 2015, but I keep getting "No Compatible Agents" errors when I try to build. Base on this answer, I don't see when/where to install an Agent.Rations
The TeamCity directory contains a default build agent by the name of buildAgent, you can go in that folder and run it.Quinton
S
5

There is nothing specific about building an Android Studio project on TeamCity. It's just a Gradle project, and you need to configure it as such.

Someplace answered 3/3, 2015 at 19:48 Comment(5)
That's great, thanks. I'm working through it now. have installed Gradle, Android SDK on build server and now get a happy 'Build Success!'. The logs look suspiciously empty ... I'll keep digging but thanks for pointing me in the right directionAssertive
My impression is that installing the Android SDK should not be necessary. build.gradle lists all the dependencies of your Android project, and Gradle should be able to download them automatically.Someplace
TeamCity complained of ANDROID_HOME missing on the target machine. Something to do with local.properties not being a part of the commit #22766497Assertive
@Someplace can u pls share how to setup teamcity for phonegap based projects ?Terrenceterrene
I found that TeamCity downloaded Gradle automatically and installed it (very sleek), but not so with Android Studio. I'm using TeamCity Professional 2018.1.1 (build 58406).Alps

© 2022 - 2024 — McMap. All rights reserved.