简体   繁体   中英

How to add correctly google_play-services

I have an android application that I have to run on my laptop (I didn't develop it). The thing is, first I had an error that said Plugin with id 'com.android.application' not found so I fixed adding this to the build.gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
} 

that works, then I go to compile the project and I have an error like this:

Project with path ':AppData:Local:Android:sdk:extras:google:google_play_services:libproject:google-play-services_lib' could not be found in root project 'Aplicacion'.

in the file build.gradle I have this:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':AppData:Local:Android:sdk:extras:google:google_play_services:libproject:google-play-services_lib')
}

it seems like I have to add a library to the project path,but I don't know which one and neither where is it. So, what things should I see to fix it? thanks

It looks like you're attempting to add Google Play Services as a dependency to your Gradle-based Android app. I'd like to suggest to just follow the instructions provided by Google :

If you want to add the full Play Services library as dependency, then add:

compile 'com.google.android.gms:play-services:8.3.0'

Alternatively, you can also selectively add the submodules/APIs relevant to your app. Ie if all you need is Google Maps, the that would be:

compile 'com.google.android.gms:play-services-maps:8.3.0'

A full list of all individual submodules/APIs can be found on that same instructions page.

要将Google Play服务添加到应用中,请参见此处的以下文档

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM