Compile Android project in Continuous Integration System Hudson? - android

I'm setting up a Continuous Integrations System with Hudson and it's just amazing.
I got a SVN repository and integrated a post-commit hook that notifies Hudson when someone commits to the repository. This part is working splendid.
The general idea is, that if the project fails, with unit-tests or anything else, it should tell the collaborator(i'm using a simple e-mail notifier atm). But if it successes I want it to compile the project and build either an unsigned or a signed .apk file.
What's the easiest or smartest way to do this?
I've read you can use a Shell Command to build the .apk but I can't seem to figure out how this works? Can anyone tell me how I can do this or should I go for another solution?
Thanks in advance
Finn Larsen

There is a guide on the Jenkins wiki about building Android apps with Hudson or Jenkins, including building and running a test app, obtaining code coverage and static analysis stats.
Essentially you can use the Ant support built-in to build your application.
If you want to run automated tests, you can also use the Android Emulator Plugin.
Since you're just starting out with Hudson, I would say now is a good time to upgrade to Jenkins. ;)

As far as I remeber hudson supports ant's builds. And android apps can be built using ant use this link for more info about building android apps with ant. Be aware that you'll have to install Android SDK on your build agent.

Android provides ant build script. So, you can make apk easily.
install android-sdk in hudson server
install ant in hudson server ( ant version should be > 1.8 )
in hudson, call cmd android update project -p <PATH to your project>
in hudson, call ant debug. debug target generates debug apk build

Related

Build (not develop) your android app .apk (gradle build) on server?

I'm trying to build(not develop) an android application on server. I've the whole native android code on the server, which I need to build according to some modification done on the server.
I've been looking all over the internet but couldn't find any detailed solution. All I got to know was I might need Jenkins or some CI tool (which I think is time consuming as I'll need to get them installed on server and then all the android dependencies).
Initial idea was to build the .apk file via some python script which contains all the gradle commands in it.
How can i do this?
Android apps can be built easily on a system that doesn't have any Android tools installed by applying the Android SDK Manager plugin for Gradle to your project.
When running ./gradlew assembleDebug (or whatever task), then Gradle will be installed and then all Android dependencies, including the SDK tools, build tools, platform versions and other dependencies will be installed automatically.
You can run this simply on the command line yourself, or automate to run after every commits to source control easily with Jenkins (it's easy to install on a wide range of operating systems).
You need to install Stand-alone SDK tools and suitable SDK packages to your server to build Android software.
When you have all installed and good, you can build APK with gradle , e.g.
(Linux and Mac)
./gradlew assemble

Upgrading Ant in Eclipse Juno

I am trying to run a test and get coverage for an Android application I developed, and because this is for research purposes, I would also like to be able get coverage for the Android source code being call as well as coverage for my application under test. I followed some advice on another question I asked and am currently trying to use Ant.
I ran
ant emma debug install test
in my test but it gave me the following error:
BUILD FAILED
/scratch/android-sdk-linux/tools/ant/build.xml:377: The Android Ant-based build
system requires Ant 1.8.0 or later. Current version is 1.7.1
I went online and installed the latest version of Ant directly from the Apache website, but now I've realized that I need to upgrade the version of Ant in the SDK directory. I haven't just simply copy and pasted because I had a feeling that would mess up with the paths in the configuration that are probably called when commands such as above are called.
What I want to know is if there is a way to update specifically the version of Ant contained in the Android SDK?
Thanks.
EDIT: I tried changing the Ant classpath in Eclipse Juno to where I stored a version of Ant 1.8.4. However, I still get the error that the current version 1.7.1. At this point, I'm sure that I need to probably change settings somewhere in Eclipse for this to work, but how?
I am not sure, if we just use different SDKs, but my android SDK doesn't contain any ant itself :)
Just some ant build files, but the normal ant installed is used. So I would assume, that you did something wrong, with upgrading ant. If you enter in your console ant -v it should print out the version. As long as this version isn't larger or equal than 1.8.0, something with the upgrade has gone wrong.

Android autobuild + tests

what is the easiest way to run an autobuild of android app, that includes compiling, running tests and creating an apk file (using ANT)?
thanks!
Use the android tool from the SDK. If you already have something that's a running project in Eclipse you just need to run the android project in the base directory of your project:
android update project --path .
And it should generate the ant build scripts needed to be able to build debug and release apks from the command line.
As for testing, there's also options to create a new test project using the android tool: http://developer.android.com/guide/developing/testing/testing_otheride.html The docs in there go through details for automating and setting up test projects.
If you're looking for a way to automate all the stuff check out one of the continuous integration servers, like Jenkins (http://jenkins-ci.org/) They're tailored to watch a software repository, automate some actions, and monitor the output.

Building android application using platform tools

Does anybody know sources in internet where described how to build an android application using it's native components such as aapt, aidl, dex, apkbuilder, etc.? Because in this link there is only description of how to build an application using ant tool.
Ant uses the native tools. There are very few guides available on how to actually run the aapt/aidl/dex/etc tools at a command prompt, and in general Ant performs all the tasks you'd like here. Is there a specific reason you don't want to use Ant?

Can't find ant in the Android SDK

I'm working my way through APress's Beginning Android 2 and I've made it all the way to chapter 3, where we build a skeleton app. The book tells me to compile my application by typing "ant" in the command line, but my pc doesn't know what "ant" is yet. I checked in the SDK files and it looks like it wasn't included with the Android SDK. Does anybody know where ant is?
Thanks
Ant isn't included with the Android SDK. I suggest you get it from the official site.
Ant is tool to build projects from commondline and it is different tool. It's not android specific. So if your are using a Debian-based/Ubuntu machine you can install it by
sudo apt-get install ant
I know it is a bit odd, but even I install brew install ant and rebuild / re-sync the gradle file, it still doesn't work, so I restarted my Intellij and it started to download the ant1.7 again from maven.

Categories

Resources