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
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 have set up a Concourse CI pipeline to run tests and build my apk. I've built a docker image for my job to run in. The image contains the sdk tools, build tools and platform tools but does not contain the platform that corresponds to the compileSdkVersion. It seems to work and build the apk correctly, I can run the apk on a device. I'm slightly confused by this as I would have thought that the platform would be required. Does anybody know how this is working under the hood and what the minimum set of files are required to compile and build the apk?
Thanks
It turns out that gradle actually pulls down the platform during the build, I noticed it in the logs.
Want to set up a linux server only to build and test, and I found Android does not offer sdk only package anymore.
Previous sdk download page was redirect to studio download page.
I need android sdk package. but now Android only supply the sdk-tool, in my mind sdk-tool/ is under sdk/, like path-to-sdk/tools. When android project builds, I need to set env $ANDROID_HOME, and $ANDROID_HOME is the directory of the sdk/ not the sdk/tool/
I try the android-studio-linux, but the pack I unzipped can not found android sdk, it seems android download sdk on first run.
I try the to find the android-sdk, but only get the older releas.
Please give me some suggestion, how to build android apk in non-gui linux server, the server is Ubuntu 64bit.
Well they still offer, they just have moved it to bottom to promote Android Studio more over other other IDEs.
Check the bottom of the page or just use this link to download it for linux. You can very well use gradle to build and package your app so if there is actually no compulsion of using Android Studio.
Update Also this document explains how to develop Android apps/libs from commandline.
I have updated my gradle-wrapper.properties to 2.10 from 2.8. But I want to know that what its purpose in Android Studio. As we didn't see any gradle-wrapper properties in eclipse.
Gradle Wrapper is a type batch or shell script that downloads and automatically configures Gradle to execute tasks. Imagine that you want to run a Gradle build, well you need to download and install Gradle in your computer, so this concept allows is to distribute our project and build configurations with no need to have Gradle installed.
Also their official gradle webiste says :
Most tools require installation on your computer before you can use
them. If the installation is easy, you may think that’s fine. But it
can be an unnecessary burden on the users of the build. Equally
importantly, will the user install the right version of the tool for
the build? What if they’re building an old version of the software?
The Gradle Wrapper solves both these problems and is the preferred way
of starting a Gradle build.
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