When dimensions of a project start being considerable the plugin of Android for Eclipse starts not working properly and also very slow, when it comes to XML modifications, refractoring the code from the XML files becomes tedious. Also sometimes it doesnt recognize strings resources. And I have to clean the project(which sometimes is like the solution for windows of restart the computer...)
Do you know about solutions to improve this behaviour? As I think it will be really helpful.
There are two things impacting eclipse's performance: I/O and memory....
I/O: Buy Good SSD disk. Full stop.
Memory:
There are few ways to improve performance:
1) include the following lines in eclipse.ini (with at least these values):
-vmargs
-Xms160m
-Xmx2048m
(that is if you have enough memory)
2) Use 32-bit eclipse on 64-bit system
That might be surprising, and it is only valid if you have not very big amount of memory (few gigs). 32-bit eclipse take about 50-60% of memory comparing to 64-bit one - the thing is that in 64-bit java every object/field etc. take 2x much memory as in 32-bit java. Until java supports (so far experimental) compressed references taking less space, it might well be that memory limits will be hit with 64-bit version where 320bit should work just fine.
Eclipse can run slow if you have too many projects open, especially if the projects are very large. I remember when i had like 3 sample projects open at the same time and eclipse went from running on 200 meg to running at 500 meg, it was really slow untill i closed all the projects i wasnt using, it also depends which type of computer you have, if your computer doesnt have very much ram then eclipse will run slow. My computer cleans projects really slow when i have a bunch of projects open.
Please make sure that eclipse.ini doesn't contains following line:
CompileThreshold=5
I have taken this line from some superfast Eclipse jvm config, but that option just makes compilation terribly slow.
Related
The memory indicator shows:
Max heap size: 1248M
Allocated:986
I have 4gb ram on my syatem.Is there anything I can increase here so that ide becomes a bit faster? I don't use emulator.
There are numerous things which will influence the speed of the IDE, and a few things that you can do to speed it up. In your case having less than the recommended RAM (5GB is officially recommended for 64bit systems), you might find optimising your system gives far more of a performance boost than optimising the IDE itself.
First up, if you are running a Windows OS, the modern versions of which use a lot of RAM (in context of a 4GB system) it might be a good idea to look at installing a light-weight linux distro like Linux Mint. This will free up system resources and give Android Studio more to play with.
Secondly, it is likely your using a web browser along side Android Studio. Browsers, especially when you have multiple tabs open, use a lot of RAM. Use a lightweight browser and be mindful of tab use.
Thirdly, offline mode. One can run Android Studio in offline mode. This will cut some of it's functionality (including code hinting), but will give a performance boost. You can find docs about that here. Enable offline mode with the followings steps (quoted from the documentation):
Open the Preferences window by clicking File > Settings (on Mac,
Android Studio > Preferences).
In the left pane, click Build, Execution, Deployment > Gradle.
Check the Offline work checkbox.
Click Apply or OK.
Since RAM allocation was specifically mentioned, we can take a look at that also.
As mentioned earlier, running windows uses a lot of RAM, so increasing heap memory allocation will unlikely glean any performance gains. It is quite likely you will end up with worse performance, since the JAVA heap will begin eating into RAM required for other system processes.
Also, for each instance of Android Studio, a new java heap will be created, further eating into limited resources (it would best not running multiple instances with 4Gb of memory).
Having said all this, there are some simple ways to edit RAM allocation. As always, be sure to have a look at these docs and these.
For per-project RAM allocation, you can add/edit this line in your gradle.properties:
org.gradle.jvmargs=-Xmx1536m
You can also permenantly edit Java heap allocation by doing the following (taken from the android studio docs):
Click File > Settings from the menu bar (or Android Studio >
Preferences on macOS).
Click Appearance & Behavior > System Settings > Memory Settings.
Adjust the heap sizes to match your desired amounts.
Click Apply.
I keep trying to build the latest Android source repository, but it always comes to a stop at one point, then it uses up just about all the system's RAM, and it keeps sitting there for hours without progressing one bit. It always comes to an end at about this line:
target Java: Contacts
(out/target/common/obj/APPS/Contacts_intermediates/classes)
and when I Ctrl+C it, it always gives me this (sometimes among others, depending on how many threads I set for make):
make: *** Deleting file
'out/target/common/obj/APPS/Contacts_intermediates/classes-full-debug.jar'
I'm trying to build aosp_shamu-userdebug on a Ubuntu 14, with open jdk 7. All over the net I found two similar questions to mine, but both had only the answers "you need more RAM". I was trying to build with 8 GB, last night i put in 8 more and left my PC to build this overnight, but come morning it had stopped at the same exact spot. I also tried building with no multithreading, in case that was the issue, but the result was the same.
Seeing as the problematic .jar has "full-debug" in it, I would suppose a "user" variant build might be successful, but it would be just about useless to me - I need to get a userdebug or eng running. However, if it would provide me with a jumping point to building what I need, I would of course try it.
Any and all suggestions on this matter would be greatly appreciated, thanks.
My colleagues and I (all using Juno on Macs) are experiencing the same problem whereby when we're working on Android code, everything is fine UNTIL we open up various xml documents (layouts, manifests, etc). Once we do, there's a limited timespan (usually about 30 minutes) before all sorts of bizarre things start happening.
Namely:
Most actions (like switching between files or saving code or changing perspectives) take multiple seconds (sometimes over a minute) with the beachball twirling.
It starts out slow - initially just delaying actions by a second or two, but pretty rapidly gets so bad that it becomes unusable and requires a restart of Eclipse. (Restarting does fix it).
I'm wondering if this is a known bug and/or if there's a prescribed remedy for it.
Increasing the heap size of Eclipse's JVM, by modifying the eclipse.ini file, usually alleviates this problem.
The default values are a little on the low side. We have a pretty big Android project and experienced big slowdowns when compiling, due to excessive GC when Eclipse approaches the memory limit.
For new installations we always use this configuration:
org.eclipse.epp.package.standard.product
--launcher.XXMaxPermSize
512M
(...)
org.eclipse.platform
--launcher.XXMaxPermSize
512m
(...)
--launcher.appendVmargs
-vmargs
-Xms512m
-Xmx1024m
Also, as NickT said, I would recommend updating to Eclipse 4.3.
I recently switched to IDEA as I often had have problems with Eclipse. Overall everything feels great. However, one issue annoys me. Building a simple application take a lot of time. If I change only one line, building takes about 1min. In Eclipse it took about 3 seconds.
I've searched a lot how to improve the performance, but nothing helped. I use the 64 Bit version of IDEA, I increased the RAM, gave the compiler a higher heapsize (Java and Android DX compiler), checked "Make project automatically" and "Compile independent modules in parallel". It didn't change the situation.
Why is Eclipse so much faster in building an .apk than IDEA is? How do you handle this long process?
In my case the antivirus software was causing the issue (ZoneAlarm). Please vote CrazyCoder's comment up, he had the correct intention. Build and launching the app takes about 2 seconds now. Great, really great.
My current game project is getting large enough that when I deploy for testing I'm waiting a few minutes to actually get this to my phone. Sometimes I have other things to work on, but sometimes I have to sit and wait. This is unfortunately slowing down the development process.
I'm already sure the biggest factor in this is package size. My package is now just under 18 Megs, but I know there are apps out there with much larger packages.
Is there any tricks, phone settings, or eclipse settings that might speed deployment other than reducing the package size?
Regards.
While this doesn't quite meet your criteria of 'other than reducing the package size', my guess is that most of that filesize probably comes from textures and audio resources.
Instead of packing them all in the APK under the res/ folder, I might recommend temporarily copying the resources to the device's filesystem, and then load them from there instead of your resources. Then when you repeatedly upload your APK you don't have to keep transferring the same resources over and over.
If you load your resources from a mostly centralized location it should be just a couple lines of code change to change from loading from res to loading from a file. You can repackage them as resources again when your game is closer to release and you don't have to do so many iterations.
what you want is an android emulator. you can install the emulator as a Eclipse IDE plugin.
http://developer.android.com/tools/sdk/eclipse-adt.html
#"Unfortunately my system is so slow (and old) that the emulator runs like molasses in comparison to running the app on the actual device."
http://dev.blogs.nuxeo.com/2011/10/speeding-up-the-android-emulator.html