The latest update to Android studio does not allow one to access the project structure GUI from a project that uses gradle. Although I have configured the gradle script to use google play services, for some reason I am still unable to use the library. Here is what I did:
- Created a new Android project
- Created a folder named "libraries" in the root directory of the project
- Copied the google-play-services folder into "libraries" and renamed it to "google-play-services"
- Created a build.gradle file in the "google-play-services" folder with the following contents:
apply plugin: 'android-library' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4' } } dependencies { compile files('libs/google-play-services.jar') } android { compileSdkVersion 17 buildToolsVersion '17.0.0' sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aild.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } }
5.) Edited my project's build.gradle with the following:
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4' } } apply plugin: 'android' dependencies { compile files('libs/android-support-v4.jar') compile project(':libraries:google-play-services') } android { compileSdkVersion 17 buildToolsVersion "17.0.0" defaultConfig { minSdkVersion 15 targetSdkVersion 17 } }
6.) Changed my settings.gradle to the following
include ':Rimatyo', ':libraries:google-play-services'
Everything compiles fine, but I cam unable to access any Google play services class from my project. All the guides I've seen online utilize the project structure GUI, which isn't possible anymore. What am I missing?
EDIT: Was able to get around the problem by importing a google play service sample app posted by Xavier Ducrohet in the adt-dev Google group and refactoring everything to make it match my project structure. Not ideal, but everything is working.