Sunday, November 24, 2013

Android Studio - Early Access Preview v0.3.6

This weekend I decided to continue the work of updating the Android Call Location project to build using the latest version of Android Studio (0.3.6). When I tried Studio in September I had copied my code into a new project to get up and running quickly. It's a perfectly acceptable way of doing things but I wanted to go through the process of migrating my code from the original Eclipse way of doing things to the newer Android Studio style.

Since version 22 of the Eclipse ADT Plugin there has been an option to generate Gradle build files when exporting a project from Eclipse. It's been ages since I used Eclipse, still on Indego, so I downloaded the latest version; Kepler. After adding the ADT Plugin and restarting the IDE the option to generate the Gradle files was there. Having Eclipse create the Gradle build files seemed like the best option but in fact was actually the cause of a few problems when the time came to open the project in Android Studio.

In my post about Android Studio Gotchas, I wrote about Android Studio using its own bundled Android SDK. Eclipse used the Android SDK that was manually installed on my system which was not as up to date as the one in Studio. This meant that the generated build.gradle file had an older build tools version.

Another thing I had to look out for was the minimum and target SDK versions. I've chosen version 8 as the minimum and will target version 18. I also set version 18 of the SDK as the compileSdkVersion and 18.1.1 for the buildtoolsVersion. These will all need to have been downloaded through the SDK Manager within Android Studio.

Since creating the application a newer version of the Google Maps API has been released so I also needed add a dependency for Google's play-services. I'm also going to be using Fragments in the app, which were not available in the Android API that was used to create the app. To add this new functionality without breaking backwards compatibility I've added support-v4 and appcompat-v7 to the dependencies as well.
dependencies {
    compile ''
    compile ''
    compile ''

No comments: