Building workspace with android application takes too long - android

In the last few days I have noticed some very strange behavior in my android project:
After every single little change of an xml-resource, the building of the android application's workspace takes a long time.
The changing of java source files doesn't cause the same slow building
And I have no idea what's going wrong.
I have already cleaned that project but it didn't help.
Is there any way to find out what is making the build process so slow?
P.s.
At about 89% i see the building message invoking 'Android Pre Compiler' on 'proj. name'

I've dealt with various eclipse problems before that slowed it down. A couple things to recommend, enable advanced garbage collection and some of the other items recommended for a performance boost in this article How can you speed up Eclipse?.
Try enable verbose build output in your preferences for android>build to see if any of your specific resources are the bottleneck.
Although I was unable to find the article, I've read about using eclipse in debug mode and profiling the IDE as you work to see if any plugins are causing interruptions.
Last, I have used the community version of intellij idea 10 http://www.jetbrains.com/idea/ which has strong android support. It's much faster than eclipse for most tasks, but doesn't have as much embedded android support (you must use ddms as a separate tool, no UI builder, etc...)

Increase Xms and Xmx parameter in eclipse.ini file.
My default values was:
-Xms40m
-Xmx256m
My new values are:
-Xms256m
-Xmx1024m

Related

Building Symbols for NDK project takes too long in Android Studio

I am working on an Android Project which makes use of the NDK and binds the rather large Boost C++ library. Upon every startup of Android Studio, the IDE takes a rather long time of about 1 hour (more or less, on an i7 quad-core machine) during the Building Symbols stage, during which it is effectively impossible to use the IDE. I guess the bottleneck is directly related to the huge number of symbols included in Boost.
Is there a known remedy to this problem? I have not seen many complaints about this problem, but this forum post seems to ask for help for the same issue: https://forum.xda-developers.com/tools/android-studio/android-studio-2-2-add-cpp-files-using-t3499634
I am facing the exact same issue - after upgrading my Android Studio installation to 2.3.3 yesterday, opening my project now faces me with at least 30 mins of "building symbols" at which point the IDE is effectively useless.
I can build the project via gradle commands in terminal, so I have no idea why this step is mandatory in AS.
I read that this may have something to do with using the NDK build (Android.mk?) vs. CMake (CMakeLists.txt), but I have not yet been able to convert over my .mk file to test this out. This is a legacy project, and the NDK portion is still somewhat of a mystery to me :(

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.

Why developing for android with multiple projects is slow on my setup?

When we first started developing for android, we had 2 projects:
One for the 'core' functionality, other for the 'business' functionality.
So far so good, we went through bad times waiting so much time for compilation of XML changes, but life was still quite bearable.
After some time, we evolved (or not) to come with 9 projects. For some projects, we have a 'test' project.
We also have some library projects, for instance, we have two different projects for different versions of android, and we have a 'shared' project for shared configs or controllers.
The reason for that is because our application is quite big.
When we make some changes on the core project, we usually have to recompile, and 'clean' the workspace with eclipse. Also, we usually have to use the 'Build Project' option a few times for the projects to update their references, the first build hardly compiles everything, we call this in our team 'COMBO', which is the combination of 'F5' and 'CTRL+B' to compile the projects.
All this setup is killing a lot of time and making developers sad, like, a team of 6 developers :(
I know that by this time we should pretty much know all the issues and the best options, but I can't believe the way it is. And after so many time searching and trying to improve, we can't seem to find other solutions to improve development time with android.
Our set of tools is:
Eclipse 4.2.1
ADT 21.1.0
Eclipse Colour Themes (for a cute code)
SDK always updated
Hardware:
Windows 7 Professional 64 bits
8 GB RAM
Intel Core i5-3470 3.20GHz
I would love answers about:
Compilation time improvement: Did you found any IDE that for YOU it was faster than eclipse? Why? How was the setup? What are the drawbacks of using ADT and how can I improve performance with it, while using multiple projects?
Project references management, is there any suggestion on how
to speed up build? Should I put the whole source code in a single project?
Any way to speed up development when you have the device and need to deploy it while testing the application?
Try Intellij.
In the latest version, 12, they made project build improvements that make it much faster than 11 and Eclipse.
Parallelization
Note also the third column, called Parallelized. This
is a new compiler option which allows you to use more than one core
for building a project. In this case the compiler runs for multiple
independent project modules in parallel. Since each compiler thread
uses file system, the benefit of parallelizing highly depends on how
fast you hard drive is. Still the average gain in performance is
spread between 10 and 20 percent for large projects.
Automatic Make
One more exciting compiler option added in IntelliJ
IDEA 12 is automatic make. This is another time-saver, which triggers
project make automatically on every change. Since the compiler runs in
a separate process, it is able to compile modified files in the
background, while you are doing something else. This means your
project is in compiled state all the time, so you don’t need to wait
any time you want to run it.
http://blogs.jetbrains.com/idea/tag/brand-new-compiler/
Also if you are using git for version control I have noticed Intellij is much better at updating after I switch branches. It integrates well with git and notices that you switched branches and refreshes and cleans out the project in the background automatically, while on Eclipse you might have to refresh and clean manually.

Android NDK incremental build

I'm currently working on a large Android app using a massive amount of C++ code.
It compiles and runs, so far so good.
Unfortunately, every time I modify something in the structure of my native source (add/delete/rename/move a file), which happens pretty often, ndk-build rebuilds the whole source, even the untouched files.
Does anyone know how I can set up the Android NDK to build incrementally somehow?
Thanks in advance
I got fed up with the NDK build system, studied it for a bit, and wrote my own makefiles. This was not hard.
However, it was then pointed out to me that by doing this, I would have to take responsibility for tracking future changes to the platform, for example if it becomes necessary to ship binaries for additional processor types, I'd have to modify my homegrown build solution to do that too.
In other contexts, I've sometimes had projects with two build systems - one for quick experiments, another for deployable builds. The time spent updating both now and then was saved many times in the speed gain for daily work. Provided I had to do a real build at least every week or two, things never got very far out of consistency (and both build scripts were in the revision control system, so there was history to examine). Something like this could be done with a custom makefile for debug builds and still using the NDK build system for deployable packages.
(In one case of doing a lot of experiments at the edge of what the platform permits, I actually had my makefile pushing the updated .so onto the device and gave my application one of the discouraged hard-quit buttons, so I could restart it using an updated native library without even having to rebuild and reinstall the apk)

Eclipse Android Plugin sluggish

I have recently installed the most recent Android Plugin for Eclipse on the most recent Eclipse version. The problem is that the syntax proposals are now very, very slow. I have to switch them off.
To be precise. If I press "." after an Android class instance, it takes several seconds, before the proposals for the methods appear, and I can continue typing. After I type a letter, it takes again seconds before I can continue.
Looks like the program is download something from a very slow server. This problem does not exist with Java core classes, and it did also not exist in the previous version I was using.
Is there anything I can do about that?
Rene
In fact, the slow syntax proposals issue is only for the android classes.
I found this fix that completely resolves my issue.
You just need to put the android source files in the sdk folder.
See the full solution here:
http://envyandroid.com/archives/66/slow-android-autocomplete-eclipse-helios-36
I tested it and it did a miracle on my machine.
I had the pauses on auto-complete too, and there's an existing question about it. For me, the solution was to switch to Eclipse 3.5 instead of 3.6; this is advised on the Android Developers website (though it's not a very prominent message!):
Caution: There are known issues with the ADT plugin running with Eclipse 3.6. Please stay on 3.5 until further notice.
Others have had luck modifying eclipse.ini settings to force Java 1.6 and increase the amount of memory used, though this was for combating general slowness.
I'm not trying to flamebait here, but please do consider the Intellij IDEA for Android development. I switched from Eclipse to IDEA for Android development about a year ago and I'm quite happy.
Intellij IDEA for Android has just been open-sourced.
I saw the keystroke delay happen when I first used eclipse as a result of using the "wrong" JRE to run eclipse (which is itself a java application). Try making sure you are using the JRE that comes with the JDK from Sun, er, Oracle. Unfortunately more nobly motivated alternatives may not work as well.
For best performance and hassle free I would recommend the best combination is :
1) Eclipse (J2EE) 3.5
2) JDK 1.6 Update 20
and remaining all are not worth for setting Android development.

Categories

Resources