Continuous integration with Android [Codeship] - android

I have an Android app source code which uses
1 Android SDK (Obviously)
2 Robolectric (for unit tests)
3 Gradle (for build process)
The problem encounter while trying to use the other build process is that I'm required go into my repo and fetch the Android SDK every time and extract it. Then, clean and run my tests and jacocoTestReport. This takes time not due to the number of tests but, due to the amount of time spent fetching Android SDK and extracting. On my local machine, I can use Jenkins with Android plugin.
My question:
Am I doing it right?
Is there an easier way around this to reduce the build time so that I can put a POST hook over my repo for it to run better (Only take up time required to run tests and reports).

Codeship doesn't support Android in this moment. But I think they are working on it

With CodeShip Pro you can utilize an Android Docker image to do builds, but this is not officially supported.
https://documentation.codeship.com/general/about/mobile-support/

Related

Increase Android Studio building speed

I'm currently working on a project and it take up to 1 min for Android Studio to build it. Yesterday I was working without Internet connection and it turned out that it needed only 30s for AS to buid the project.
What is the reason? Does it mean that the building process check something online each time it builds? Is there any way to change that?
My project has 2 submodules and I would avoid them to be built each time I build the project as nothing as changed. Is there a way to do that?
Best way to speed up ,is to use instant run feature and make sure you have Android Studio 2.3 and higher to support this feature.
Follow this link to you instant run
https://developer.android.com/studio/run/index.html

Android Build Server for a 1 Programmer "Team"?

Would you recommend the overhead of installing & configuring an Android build server for a 1 programmer project?
The alternative is to upload all sources from development computer to git, download to another computer with Android Studio & Android SDK, and build from Android Studio.
If the answer is yes, would you recommend Jenkins, or another solution?
IMHO, yes, if you have significant time to set it up and maintain it on a separate machine. (I personally would not use a shared machine: too many reasons to restart and disrupt it.)
I feel an extra level of confidence each time I check in if Jenkins builds the whole project successfully from a fresh dir (one less thing I have to do.)
If I forget to check in an important file, Jenkins complains. Or, if I code something that generates a new Lint warning, Jenkins puts a spike in the graph. In other words, on solo projects, Jenkins is like an assistant (or mentor) that helps check my work.
Jenkins can warehouse app installers for future reference. So, it also helps me stay organized.
Jenkins offers some nice communications capabilities too. You can have it automatically notify others via Slack, or put an installer on Dropbox, or, through a service like Zapier, create a custom card in Trello. So Jenkins gives me an outward-facing messenger and delivery service.
These are some plugins I have found useful with Android builds:
Android Lint
Credentials Binding
Environment Injector
Gradle
Slack Notification
ThinBackup
Version Number
Zentimestamp
Of course, this only scratches the surface.
It requires some ongoing maintenance work though. And sometimes it's confusing/challenging to configure. (e.g. some plugins are poorly documented or no longer actively maintained. The linter in Android Studio is not exactly the same as the default one run through gradle by Jenkins, etc)
When I first set my build server up, I had a couple weeks of downtime when I was able to experiment with different plugins and troubleshoot the server. I probably wouldn't have done it without that empty window of time at the start.

Different Way for making Gradle Faster

I have been working on android from some time. Since starting i have searching ways of make the grade efficient and fast. i went through many post and i find many solution. which i am listing here.
After building first time switch to offline mode.
make parallel exception check in grade compiler option.
use Dexoption to increase the heap size.
I am looking for if is any other thing which can help reducing the gradle time.
A. what are the other option which can be used in gradle to make is efficient and fast. ( i am looking for both gradle normal and experimental plugin - as dexoption are not available in experimental plugin)?
B. Is there any drawback of the instant run on the build time introduced in studio 2.0?
C. Which is the gradle plugin version best for android 2.0?
D. Any other thing which we can implement in code or in script to decrease the build time and run time?
If you have:
Android Studio 2.0+
Gradle 2.0+
minSDK API 15 (Android 4.0) declaration in your app
your device is API21+
then you should be able to use Android Instant Run feature.
As described here app are building almost instantly in most cases. There are 3 running modes available: hot swap, warm swap and cold swap.
Building speed depends of code change scope.

How to run specific tests / suite in new android build system on specific device

We are developing android app. We have a project, multiple libraries and several test projects. Some of the test cases in test projects are organized into suites.
Our layout seems like this:
Root
Application
Library1
Library2
AppTest1
suiteQuick
suiteDeep
AppTest2
...
Everything works (somehow), but for various reasons we have decided to migrate this into the new build system, based on gradle. Here is where the troubles begin.
As I understand, in new project layout required by the new build system, the tests reside in the same project as the application / libraries (in folder instrumentTest).
I can imagine we could collapse all this AppTest applications' source codes into single instrumentTest folder of the Application, but we definitely do not want all the tests to launch in the same run.
For instance, the tests from AppTest1.suiteDeep takes approximately 45 minutes and as such are not suitable to be run after every single commit into Gerrit-managed repository for commit verification.
Another issue is regarding the target device. On our CI server, we've got attached several Android devices, but we don't want the tests run on all of them. On old build system this was easy, all we had to do was to specify via ant on which device the instrumentation to run.
But with gradle all the connected devices are used in parallel. I believe this can be sometimes useful, but it is not suitable nor desired behavior in our environment.
I looked everywhere on the net, but I was not able to find a solution for any of these problems. Any tip will be appreciated.
I'm currently using gradle android plugin v 0.8.1.

Android Studio compile linked libraries only when changed

I have a project in Android Studio which has two libraries linked. The Google Downloader and the Licencing library. Every time I want to run the app on a device it takes more than to 1 minute.
I have a gut feeling that the libraries are compiled every time, even if I haven't changed it.
Can anyone confirm this? And if it is so, is there anything I can do to speed up the process?
Found another thread which describes the same issue. I might update Gradle etc.
Building and running app via Gradle and Android Studio is slower than via Eclipse

Categories

Resources