Google Play services in Android Studio 0.1.1 gradle project?

The latest update for Android studio does not allow access to the graphical interface of the project structure from a project that uses gradle. Although I configured the gradle script to use Google Play services, for some reason I still cannot use the library. Here is what I did:

  • Created a new project for Android
  • Created a folder called "libraries" in the root directory of the project
  • Copy the google-play-services folder to the "libraries" and renamed it "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 the build.gradle project as follows:

 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 .gradle settings to the following

 include ':Rimatyo', ':libraries:google-play-services' 

Everything compiles fine, but I canโ€™t access any class of Google services in my project. All the manuals that I saw on the Internet use the graphical interface of the project structure, which is no longer possible. What am I missing?

EDIT:. I managed to solve the problem by importing the Google Play sample download application hosted by Xavier Ducrohet in the adt-dev group of Google and refactoring everything to fit my project structure. Not perfect, but it works.

+4
source share
2 answers

Could you try to create the project first from the command line and then import it into Studio? If this works, then you will click this error: https://code.google.com/p/android/issues/detail?id=55784

0
source

Source: https://habr.com/ru/post/1483208/


All Articles