Increase Android Studio building speed - android

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

Related

Easiest way to code/debug in Android studio without Gradle

So a couple of days ago, I decided to start android programming using Android studio. After installing the IDE I had some problems syncing Gradle (discussed here). Now I'm trying to use Android studio without Gradle. I've read some topics about using Ant etc. but I don't know which one is the easiest way to do that, And most of them weren't talking about Android studio.(note that I want to use Android studio and build/debug apps normally, just like someone who uses Gradle)
Gradle is the build system for Android. Android Studio uses it for all its builds. You can't build without using Gradle. There were alternative build systems years ago, but they stopped being supported almost a decade ago now. While it would be technically possible to build without gradle, you'd be doing months of work to get a basic build up and running because you'd have to rewrite EVERYTHING google's build does using the alternative system.
Basically you can spend a few days figuring out how to fix your gradle setup (which will almost certainly end up being trivial) or you can spend the next year writing a build system. Pick the first option.

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.

Continuous integration with Android [Codeship]

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/

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

Why Xamarin.Android rebuilds entire solution upon run?

I am using Xamarin Studio with Xamarin.iOS and Xamarin.Android. My workspace contains two solutions, one for android, another for ios. Projects are pretty much the same. When I build the solution for ios, it rebuilds only changed projects. It does some additional operations which take really little time. So pressing Build second time takes virtually no time.
But when I build the Android solution, it rebuilds all projects regardless of changes in files, configuration and so on. If I press Build after successful build, it rebuilds it all over again. Even worse, if I try to Run a just built project, it rebuilds it! Furthermore, if I run the project after run (when you debug a program, it happens often), it rebuilds it again. As I have many projects, it takes really long time, plus the compilation is very CPU-dependant, so improving speed is hard.
Generally, the question is if it is possible not to rebuild entire solution upon every build? Maybe there is a configuration option I am missing, or something is misconfigured?
I don't know if anything in projects configuration is relevant to the question, so please tell me what part of solution/projects configuration may help.
Versions:
Xamarin Studio
Version 4.0.9 (build 12)
Xamarin.Android
Version: 4.7.11 (Business Edition)
//I thought that separate compilation nowadays is a must in every serious compiler, so I assume, I have done something wrong.
UPD:
I have installed latest versions of Xamarin Studio and Xamarin.Android:
Xamarin Studio
Version 4.0.12 (build 3)
Xamarin.Android
Version: 4.8.1 (Business Edition)
It takes 1 minute 58 seconds to rebuild the android solution. Every time when I run the application.
Honestly, this sounds like a bug in Xamarin Studio or the xbuild build tool, at least, assuming you don't have any custom build steps (which you probably don't)? Could you file a bug report on https://bugzilla.xamarin.com? Thanks! It really shouldn't rebuild the project each time.
I'm really happy to hear that your iOS project doesn't rebuild, though, because I'm the maintainer of the iOS build code :-)
I would think the reason for complete rebuild, when you want to run is because an APK file is not generated when just rebuilding. It is first generated when wanting to either deploy or run the project.
It's not a bug, I have the same features, and I have wasted lost of time waiting for each run in debug mode. I think using Xamarin has cost me 10x more time than using any other development environnement cause of tons of problems like this...
It's an unprofessional tool.

Categories

Resources