Posts tagged android
Learning Android : Why I moved away from Eclipse
0So, after a very long break, I started back with getting familiar with Android development… Felt happy seeing that Google has made a lot of improvements / features in the ADT. But, everything evaporated when I tried to debug an app on my machine, and got this error: “Android Packaging Problem: resources.ap_ does not exist”. I tried cleaning the project, restarted Eclipse, and re-creating the Eclipse project and this error didn’t go away… Googling it also didn’t help much… Then, I went to sleep….
The next day, to my surprise, there was no error and I was able to debug my app, at last… But, it didn’t last long… After 3 hours, the same error is back…. It looked like this ADT solves everything else (Resource Editors, WYSIWYG Editor etc.) but the basic task it is supposed to do (Basic compiling / packaging / debugging)…
Now that perfect mood is set to go hunting for a new and *reliable* IDE, I searched in stackoverflow.com for answers… Found some thread saying IntelliJ IDEA is good…. So, downloaded it, downloaded its dependencies (JSDK 1.6) and installed them… And there is no turning back… I don’t miss the resource.ap_ error at all…
The Pros of IDEA:
- Reliable (unlike ADT for Eclipse) at compiling and packaging…
- Supports the Android “Library” projects also… (Tried it with GreenDroid, and worked without a glitch)
- Import Eclipse projects directly…
- Integrated github support (and a few more Version Controls)
- Decent enough features, for Refactoring, Imports optimization, Code completion etc.
The Cons:
This could become a big list, but the reliability when compared to Eclipse beats everything in the below list combined..at least for me…
- Page Scrolling – Cannot use the Mouse Scroll.. Need to click on scrollbar and scroll it down..
- Logcat sucks!! The one in Eclipse is hell lot better.. Seriously needs Filter by Application, Colored text based on log level, and saved searches.. A simple textarea doesn’t justify such an important feature..
- The keyboard shortcuts are completely different from Eclipse.. Why doesn’t IDEs come with keyboard binding set of other IDEs that user can choose to use?
- Memory hogger, seems to be more than Eclipse.. Could it be because of Swing & Java?
- Basic XML Editor – There are no Android Resource Editors…. I prefer to write XML files by hand, though…
- Some code warnings may misguide you.. It keeps telling me that Cursor cannot be NULL, though I have personally seen cases where it will be…
In simpler words, IDEA may not be as good as Eclipse in general, but for Android development, it is certainly a better choice… at least for now..
Atleast, you’ll know you are frustrated not because of IDE… (Trust me, frustration because of an IDE, instead of logic/code isn’t even worth trying to know.. )
Learning Android: Part I
1I will use this post to talk about my ‘Getting familiar with Android’ learning. As announced in the last post, I’ve started learning Android, but not even at half-pace as I wanted to.
Anyways, let me tell what I’m doing in learning. I’m using ADT on Eclipse Helios and using the Emulator for testing purposes. Currently focusing on the samples present along with Android SDK. Gone through the Application Fundamentals available along with the SDK.
Interesting Things:
- Most importantly, its good to see myself learning the things I’m interested in from the start (FYI, I always have that thing for Web & Mobile Development)
- Very clear & highly helpful documentation (and, also downloadable). And the docs are developer-focused & also lays emphasis on good practices at every step, like i18n, using resources instead of hard-coded strings etc. etc..
- Separation of layout of the app and the application logic (supports XML files for layout). I get the feeling this is inspired from Flex (mxml & as), but I don’t know.
- Provides a very good mechanisms for interoperability between various applications. Simply said, I can use the capabilities of other applications installed, and also I can expose my app’s capabilities to other apps. Also, Android search also integrates good with any application’s search.
- Application Development is done in Java, which is said to be a very developer-friendly. I can utilize this to brush my skills in java, as I have other plans to work in Java in some not-so-far future.
Annoying Things:
- Tabs are NOT simple to use. I’d prefer a way to declare tabs and its contents in the XML itself.
- In TabHost, mandatory referencing of elements to’ tabs’ & ‘tabcontent’ doesn’t look like a good programming feature.
- Missing the tabs & tabcontent id referencing in the TabHost would give no error / warning by Compiler, but fails at Runtime, without any proper information (even while debugging)
- Emulator takes very long time to start. So, its preferred not to close the emulator after every run. (start along with eclipse and close it before closing eclipse)
- Emulator keyboard shortcuts – Not too easy to remember (like, Ctrl + F12 for Toggle Portrait / Landscape modes). I’d have preferred if the emulator itself has a help button, to show the shortcuts.
- Nothing to do with Android, but the bug in Helios (Eclipse Web tools plug-in) has become a pain, forcing me not to us any features while editing resources. Bug – https://bugs.eclipse.org/bugs/show-bug.cgi?id=318108
- Again, may not be related to ADT (frankly, I don’t know), but the auto-complete context is very slow, taking 30-60 seconds (which is tooooo long, btw). Here again, I’m forced to disable Auto-Activation of context Assist at ‘Window -> Preferences -> Java -> Editor -> Context Assist -> Enable Auto Activation’
- I can’t run the application when my focus is on layout files (on resource files, for that matter). I always need to switch to a java file, to run (Ctrl + F11) the application
- The layout filenames cannot contain uppercase letters. If it contains, the error shown doesn’t help in identifying it
Unclear points for me:
- In Android XML, for TabHost, @android:id/tabhost works ( i.e; referencing other element with tabhost id ). How can access this element from my Activity class? (since, no reference is created in R.id )
- Is XML compiled ? Or interpreted at Runtime? If compiled, how can I see the generated Java (?) files? (something similar to -keep compiler option in Flash Builder)
- And many other things (like, working of Intent, i18n, logging), but these are somethings I need to learn as I dive further in android..
Tasks for coming days:
- Finish the Tutorials in the resources, and then go to the samples folder available with the SDK.
- Try to make a couple of simple *usable* apps, so that I get enough practice with the SDK APIs
Also, attaching the projects HelloAndroid.zip and HelloViews.zip I made during my learning.
Wish me that I gain pace in learning Android over the next few weeks…
Installing Android !!!
0Few steps for setting up things before developing applications for Android….
- Download & Install JRE from http://www.java.com/en/download/manual.jsp
- Download & Extract Eclipse IDE for Java Developers from http://www.eclipse.org/downloads/
- Download the latest version of Android SDK from http://developer.android.com/sdk/
- Download ADT (Android Development Tools) from http://developer.android.com/sdk/adt_download.html
- Start Eclipse, then select Help > Software Updates > Find and Install….
- Select Archive and then browse to the downloaded ADT Zip file.
- You should see the plugin listed by the URL, with “Developer Tools” nested within it. Select the checkbox next to Developer Tools and click Install…
- On the subsequent Install window, “Android DDMS” and “Android Developer Tools” should both be checked. Click Next, then Finish. Restart Eclipse.
- Select Window > Preferences… to open the Preferences panel (Mac: Eclipse > Preferences).
- Select Android from the left panel.
- For the SDK Location in the main panel, click Browse… and locate your downloaded SDK directory. Click Apply, then OK.
- Now, lets install an AVD (Android Virtual Device). Navigate to /tools in a command line and execute:
android create avd --name #your_avd_name# --target #targetid#
- Just press Enter when asked to create an hardware profile.
Now you are done with setup……. Happy developing with Android !!!
Start with Hello, World program in the documentation.
–
Sai Prasad