Setting up TeamCity to build Android Studio project
Solution 1
Thanks to Yole's direction, I've set this up now.
The steps if anyone is interested are below:
- 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
- Set the environment variable GRADLE_HOME = C:\gradle-2.3
- Install Android Studio on the build agent server. This should also install the Android SDK
- Set the environment variable ANDROID_HOME = C:\Users\%Current User%\AppData\Local\Android\sdk
- Restart the TeamCity agent server
- 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!
Solution 2
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.
Dr. Andrew Burnett-Thompson
Andrew Burnett-Thompson is the CEO & Founder at SciChart, a High Performance Realtime WPF, iOS/Android & JavaScript Charts, I have experience in high performance software (C#, WPF, C, C++), algorithms, data-visualization (DirectX, OpenGL), JavaScript, WebAssembly and mobile app development in scientific, banking and trading systems. Follow me on twitter at https://twitter.com/@drandrewbt where I tweet about entrepreneurship, coding & programming, health & fitness, and more.
Updated on June 16, 2022Comments
-
Dr. Andrew Burnett-Thompson almost 2 years
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?
-
Dr. Andrew Burnett-Thompson about 9 yearsThat'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 direction
-
yole about 9 yearsMy 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.
-
Dr. Andrew Burnett-Thompson about 9 yearsTeamCity complained of ANDROID_HOME missing on the target machine. Something to do with local.properties not being a part of the commit stackoverflow.com/questions/22765997/…
-
Erum almost 8 yearscan u pls tell how can i do implementation of TeamCity in Android Studio project ?
-
Dr. Andrew Burnett-Thompson almost 8 yearsI 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.
-
Erum almost 8 yearsi knw the first part and i have installed TEAMCITY but getting issue for 2nd point can u pls help me @Dr. ABT
-
Erum almost 8 years@yole can u pls share how to setup teamcity for phonegap based projects ?
-
Chris about 6 yearsTrying 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.
-
Nick Wright over 5 yearsI 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).
-
Ahmed Shahid almost 4 yearsThe TeamCity directory contains a default build agent by the name of buildAgent, you can go in that folder and run it.