Building medium size android application is very slow - android

My application has a bunch of external .jars, android libraries, and a plenty of code. Bulding the project (I am using eclipse) is terrible. It takes few minutes to do clean/build. And after each rebuild I have to restart eclipse, otherwise it just hangs on second build. I am afraid that soon I'll not be able to build it at all!! Giving more memory to Eclipse has no effect.
On the other side, there is absolutely no problems building small android applications.
I am on Windows Vista, eclipse-java-galileo-SR2, Android SDK Tools (revision8), Core 2 Duo 2GHz.
Q: It would be great to hear from other developers having pretty big projects, if you have same issues, and how you solve them?
An other issue that I see, is that compilation hangs some times since it can't communicate with emulator. If I close emulator, it may complete.

I added more physical memory. Running eclipse with such parameters:
eclipse.exe -vmargs -Xmx700M
Now I have more than enought of memory. It is ~1Gb of extra free RAM available.
Project rebuild takes ~1m 10s, that is about twice faster than it used to be, but on the other side this is still not ideal.
An other positive effect - I don't have to restart eclipse after each rebuild any more.

Related

Android Studio emulator crashed, now I can't start Android Studio

I accidentally ran my Android Studio project on an emulator (for a different device) instead of my real device (forgotten I unplugged it), and the whole computer froze/ran out of memory. No big deal I thought, I turned off my computer and started it again.
However, now when I start Android Studio, I run into problems. It first says indexing for a very long time (like 10 minutes+), then it goes to Building symbols also for 10 minutes+, until it warns me about low memory and eventually runs out of memory.
The out-of-memory error window gave me the opportunity to increase the memory limit and I tried increase the memory field to 2000 (from 1200 something), and that is where I am now, still building symbols 20 minutes later.
Edit: Now it ran out of memory again.
Note that before, when I start Android Studio, everything was set up
within minutes
What should I do? Do I have to reinstall Android Studio? Should I change these memory settings to something else, or clean up Android Studio settings somehow?
What finally worked for me was downloading version 3.2 of Android Studio (if I download via Ubuntu Software it is version 3.3), installing to a different directory and reinstalling the sdk to a different directory. Not sure what part of that was the solution, but anyway, if anyway has the same problem they can try this.
Try going to File then Invalidate Caches / Restart
Try going to C:\users\.android\avd and remove all folders. If the issue is related to your emulators, deleting all folders might help.

Android Studio not executing, it only shows splash screen

Android Studio not executes the IDE, it only shows the splash screen, after few seconds, it dissapears.
I tried the following solutions:
I uninstalled the program and installed again
I restarted my PC after installation
I added "JAVA_HOME" and "JDK_HOME" as environment variables
I checked if "studio.exe" process is executing, if IDE is executing in background.
I executed Android Studio as "Administrator"
I disabled Antivirus temporarily
I deleted ".android", ".AndroidStudio", ".gradle", ... folders
These solutions not worked.
Which is the problem with execution?
If you have done this:
do you have installed the JAVA SDK donwload the latest release from here!
be sure to have configured the JAVA_HOME and JDK_HOME in your environmet variables.
then check the .log file generated by Android Studio to get more information about your issue:
C:\Users[MyUser].AndroidStudio1.2\system\log\idea.log
I recently experienced this issue as well.
It was related to me having dual monitors and oddly the secondary screen was not able to load android studio.
In my setup the issue resolved itself once the secondary screen was made the primary screen ( I have an ATI graphic card 8300) with Android Studio 2.3 and Canary build 3.x
This is typicaly a low memory problem. I currently have the same and I was able to make few correlations. If you start your task manager, you will notice that "Disk" goes to ceiling when starting Android Studio. Actually, you will surely notice that it goes more often to 100% that you'd expect and Android Studio is just the perfect vector to observe this, since it consumes a lot of resources.
The annoying part of the answer is that this "Disk 100%" bug on windows 8.1 is really widespread and solutions doesn't seem that straightforward. For the record, if I find my cause (or if I'm all wrong in my hypothesis), I'll keep you posted.
Regards

Gradle - high CPU use

I recently started to use Android Studio and while I like it a lot, there is one thing that annoys me a lot:
Gradle - it's nice tool and all, but damn it's such a resource hog, also it's just so painfully slow. No matter if I use my 5 years old laptop or my gaming PC, when it's running, other applications go to a full stop (well almost)...
Is there really a reason for a build tool to be so demanding??? I understand compilation can be a slow process but from my experience javac always seemed to be blazingly fast, so it cannot be source of a problem (also building Android apps with ADT was many times faster too)...
So is there something wrong with my configuration? Can I make Gradle run faster?
Create a gradle.properties file either in your project root directory or your ~/.gradle directory with the following line:
org.gradle.daemon=true
From the Gradle manual:
The Daemon is a long-lived process, so not only are we able to avoid the cost of JVM startup for every build, but we are able to cache information about project structure, files, tasks, and more in memory
Also, you can go to File > Power Save Mode if you want to turn off continuous building in Android Studio.

Why does my Android Eclipse Emulator never launches?

I have Eclipse with Android set up. The problem is when ever I run a project from eclipse to test it, the application never launches and the emulator never shows up. Even though the launching progress bar shows 100%.
Make sure the AVD's memory is set to 512, if it's higher the emulator will get a memory heap error and fail. Also try to enable verbose output when building, this can be set from within the properties.
Do you have a device attached? Eclipse switches to mobile devices automatically
I had once or twice had such problem. Restart of eclipse worked for me. And Yes also check the Run configuration, make sure your project is linked with emulator.
Go to Window->Preferences->Android->Build and select verbose build output
Now run your project and check Android console. In my case there were thousands of
"Dx processing %classname%..." which took several minutes to finish.
Just to make it clear: dx.bat is an ADT utility program, it converts multiple Java class-files to single "classes.dex" file(Dalvik executable file).
I had a project which used several libraries with lot of classes and the compilation was very fast(several seconds), but the launching was quite slow(2-4 minutes).
Then I found out that the most time consuming part was converting class files from my project and from all third-party libraries to *.dex file(the resulting size of dex-file was about 4 Mb). As far as I know, it's impossible to attach libraries to android project without dexing their class-files, so you have to be patient during launching your project.
UPD: It's possible to strip all unused code from your application.
Please check this link: Always running proguard before Android dex'ing in Eclipse

Alternatives to compiling in Eclipse?

The following situation will surely be familiar to any Android developer using Eclipse and ADT.
I'm tired of this endless cycle of switching Build Automatically on and off, running Clean, building and running. I'm constantly doing all of these operations when I'm fine tuning UI (i.e., editing XML files and needing to see the results live), and any time I save, an Eclipse window telling me I have these pending operations shows up. When that happens, I turn off Build Automatically. I do my alterations and then run. Sometimes Eclipse decides the changes in the XML file weren't enough, and it won't reinstall the app in the emulator or device, so I force a build and install.
All of this is just wasted time. I've already done an AppleScript to build & run my app into all the emulators and devices I have connected at once, described in this SO question, but my workflow could be much improved if I found a way to save and build silently and fast.
Does anyone have any tips or alternatives?
IntelliJIdea Community Edition now supports Android
Have you tried the bundle for Textmate? It's pretty cool. It's basic but its got all the features you need. Building, Deployment and integration with AVD and Logcat.
I use this for all my Android Dev now as I found Eclipse painfully slow.

Categories

Resources