Sunday, October 20, 2013

Android Studio Gotchas

I decided to carry on with some programming today using the Android Studio EAP. On opening the IDE there was a prompt to update to version 0.3.0 so I chose to update and restart. Subsequently much of my time was spent trying to work out why my project wouldn't build anymore.

The first problem was a simple fix. I prefer to use my local Gradle distribution rather than a Gradle Wrapper so I downloaded the latest version (1.8) and changed my GRADLE_HOME environment variable to point to the new version and restarted Android Studio.

The next problem was that the appcompat-v7 dependency could not be resolved. The Android Support Library package is needed for backwards compatibility without it my project will not build. When running the Android SDK manager from the terminal I could see that it was installed and up to date. This baffled me for some time, then I found that Android Studio wasn't actually using the Android SDK that I have installed on my system. The IDE has its own Android SDK bundled. I personally don't like this as I don't think the SDK belongs in the installation of Android Studio. I want the flexibility to chose where my SDK is installed. Once I realised that the SDK on my system path and the SDK being used by Android Studio were not the same it was easy to fix. Use the IDE to open the SDK Manager under the tools menu, then once updated restart the IDE.

No comments: