android: workaround for slow ‘building workspace’ problem in eclipse

While developing for android on eclipse 3.6 i had the problem that each time i saved a file, eclipse blocked me several seconds with ‘building workspace…’. Similar to these:

stackoverflow – android-compilation-is-slow-using-eclipse
stackoverflow – android-eclipse-workspace-takes-a-long-time-to-build
groups.google – android-developers/thread/a16202975510de39


The best workaround i found for me:

  • disable Android Package Builder (right-click on project#Properties#Builders)
  • use ant build to deploy on emulator

This way i can work (as) fast (as usual) with eclipse, everything compiles and gets generated, but once i want the app on the emulator, i execute ‘ant install‘ from console.

Setting up the ant build is quite easy, see using-ant-to-automate-building-android for details.
In short you have to simply execute ‘android update project --path .‘ which generates your build.xml.


Note: If you have 3rd party jars put them in ‘libs’ folder, that way ant is aware of them.

Note: You also can build a signed apk with ‘ant release‘. Add therefor a build.properties with such a keystore setup:


key.store=/Users/jz/.android/debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android



PS: i also stumbled into the ‘external folder’ synchronization problem. Closing all android projects and reopening again helped!

Advertisements

3 responses to this post.

  1. Posted by Marco on September 2, 2011 at 2:29 am

    As alternative there is an option in the Android plugin for eclipse:

    Eclipse Preferences => Android => Build => Check “Skip packaging until export and launch”.

    Reply

  2. Posted by drasko on March 30, 2012 at 9:07 am

    Disable Lint Error Checking too:

    Eclipse Preferences => Android => Lint Error Checking => Uncheck option “When saving files, check for errors”

    Reply

  3. Posted by paul on September 7, 2012 at 8:28 am

    thanks a lot

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: