Amazon Gift Cards

Thursday, November 25, 2010

Using library with resources in IntelliJ and Android

As my previous articles indicates, im coding more Android in IntelliJ then eclipse (main reason is that it will let you forget you have a mouse). For those new to IntelliJ, like me, here is how i set up the library in IntelliJ so that both resources and code could be used.

• Im new to IntelliJ so if im doing something wrong, kindly comment below :)
• As of writing the resources between library cant be handle properly when compiled (you can still do the coding with it) thus we need the help of command line (ant install, adb install/uninstall), on the Bug tracker it was reported to be fine in nightly.

What Do I Need
• As of now you need the EAP of IntelliJ
• Lastest Android SDK
• You need to know how to create a project
• You need to know how to create a library

1) Open your project's module settings

2) In Modules, click the add new module (see image below)

3) Select your library if you had previously created one

4) Browse to your libraries path/directory. and select the file with the extension .iml

5) First click on your project (the red circle) then on the dependencies tab, click on add then Module dependencies (it shall have only one module)

Easy Updates 468x60

Command line
So you can code with your favorite IDE and now you want to debug it on the emulator. you could do (please refer to Developing in other IDE (You must have ant in your OS)
cd /path/to/your/project
ant debug

It will then tell you that where the apk is at
[echo] Running zip align on final apk...
[echo] Debug Package: /path/to/your/project/bin/shootAndLearn-debug.apk

Now you have to install it on the emulator, please refer to Android Debug Bridge page
adb uninstall com.almondmendoza.shootAndLearn
adb install bin/shootAndLearn-debug.apk

adb uninstall com.almondmendoza.shootAndLearn
We have to uninstall the apk from the emulator first before

adb install bin/shootAndLearn-debug.apk
installing it

I know the debugging part is kinda hard right now but the development/coding part is certainly a lot better (got to love the ctrl+w, ctrl+shift+a shortcuts) :)

No comments: