The Stumble Stones
The Android Team’s switch from the Eclipse based Android Developer Tools to the IntelliJ IDEA based "Android Studio" at Google I/O is pretty well-known. But what isn’t too well-known is that they also changed the default android project directory structure as they switched their build system from ant to gradle.
Further information on the new structure and the new build system are available here: http://tools.android.com/tech-docs/new-build-system/user-guide
I decided to go with the new Gradle-based structure as I thought it was more future proof. I have to admit that I regret this badly! As I’m not too familiar with Gradle, yet, I had a pretty bad time trying to understand the customizations brought in by the gradle-android plugin. Additionally most of the information available on the net is specific to Eclipse/ Ant based projects and therefore slightly different for the new structure.
download Android SDK
extract it to e.g. ~/dev/android-sdk-macosx
modify your .bash_profile and add
Things of great help #not
IntelliJ project creation wizard > creates eclipse/ Ant structure
Android Studio project creation wizard
Pivotal Labs' "AndroidIntelliJStarter" https://github.com/pivotal/AndroidIntelliJStarter
These utilities turned out to be buggy or outdated and partly messed up the working configuration. Don’t use them!
1. Before you try things out, go RTFM.
It might take you two weeks to read https://developer.android.com/design/index.html and https://developer.android.com/develop/index.html but don’t dare to start before this! Except if you like to start-over or rewrite your whole Application. ;)
2. Before you use a library, assure that it works with Gradle!
Questions and Answers
"What is the differences between the px, dip, dp and sp units in Android?"
dip = Density-independent Pixels
sp = Scale-independent Pixels
The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".
Q: IDEA tells me "Project directory not specified"
A: Probably your ".idea/gradle.xml" is messed up. See this bug report: https://code.google.com/p/android/issues/detail?id=56750 to fix it
Q: My tests fail with "!!! JUnit version 3.8 or later expected"
A: The reason for this is that the android.jar contains a version of JUnit prior to 3.8! You can fix this by opening the "Project structure" settings > your module > Dependencies and putting the "Android Platform" dependency all the way down the list.
In the meantime there are a few really awesome videos available on Gradle and Android, that I’d like to share with you