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.
Related
Android studio provides lots of plugins and features to run the task more quickly. There are two ways to run Android applications that I know,
Download Gradle and run in cmd. (Without Android Studio)
In Android Studio generally, all developers do in this way.
I know the major differences. Can we run below tasks without Android Studio and with installed Gradle and in CMD.
E.g.
I want to clean build in cmd without Android Studio.
Generate signed APK in CMD.
Run test cases in CMD.
Make sure to run above tasks there will not be any dependency on Android Studio.
The two ways are totally the same.
Also, with Gradle, you do not run Android applications. Gradle is your build tool which has a plugin for build steps necessary for Android applications. Android Studio offers you an integration of the mentioned build tool, but you are free to use this integration or a standalone Gradle installation.
However, take care about different versions of Gradle, this may cause your build files to only work with either the standalone or the Android Studio Gradle installation. Also, it may be possible, that the two installations do not share temporal folders or global properties, as they expect them in different directories.
For my part, I use the Android Studio Gradle installation with the tool integration, but switch to a standalone installation for continouus runs (e.g. a Gretty container).
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
So I have an android app with an app engine backend (App-Engine Connected Android Project). Back when I used to work in Eclipse, I could compile the backend, then generate the endpoints for android, and then work on android. But now on Android Studio I don’t seem to be able to build the server without it building the android app as well. The problem with that is my android app is not ready to compile. So how do I work on the server and compile it and deployment apart from the android app? Needless to say I am extremely new to Android Studio. But I know the eclipse workflow, which is
Work on server code (develop, compile, test)
Generate client endpoints for android
Your Android Studio Project is likely to be a multi-module project i.e. it will be having a server side app and an Android app.
Android Studio uses Gradle as its build tool and hence you have the option on working on specific Gradle tasks (clean, compile, build, etc) on each of the projects separately. You need not always launch or run the overall Build process that will try to look at dependencies and then build all the stuff.
Since you want to work on the Server app separately and make that ready, I suggest that you can run the build tasks specific to that project. In the commander view you will see Gradle tasks for each project separately and you can run that. Alternately, you can also go to the terminal and look at the tasks and/or run those separately.
For e.g. let's say that you have an Android Studio project named MyApp and it has two modules in it called app and api. The app is the Android module and api is the Server side module with Cloud Endpoints. If you visit the terminal or command line and go to the root folder you can run Gradle specific tasks for each of the modules via gradle <modulename>:<taskname>.
Hope this helps.
Assuming a project structure of MyApplication (root) with app (android) and backend (appengine)
If you want to build only the backend. You should run the assemble task on that gradle module. Unfortunately running the task directly from the "Gradle" tab doesn't seem to run the task against the module alone, it runs it on everything. So you have two options.
run build from the command line : ./gradlew :backend:assemble
create a run configuration in the IDE for your gradle build, with the values
Name:Backend Build (or something),
Gradle project: MyApplication:backend (pick from dropdown),
Tasks :backend:assemble
and use that to build your backend by itself.
Both seem kind of annoying. You can also try to initiate an individual module rebuild directly when you run.
If you take a look at your backend run configuration (Run -> Edit Configurations), in the section Before launch:, you see a Make which does a project rebuild. You might need to remove that from the run configuration so it doesn't try to rebuild the whole project before deploying. To replace that with a gradle assemble of your module, click the +, and add a new Run Gradle task and configure it as above in "2".
I've filed a bug against this : https://code.google.com/p/android/issues/detail?id=168875&thanks=168875&ts=1429554595 I think the default behavior should be switched (use gradle assemble instead of make).
Generating Client libraries is done with some magic in Gradle. If you look at the build file for your Android App, it should reference a configuration on your backend called android-endpoints so the endpoint are generated as a compile dependency of your app module
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
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?