When I try to compile I get this error "Failed to resolve: com.google.android.gms:play-services:fp9.0.0" in Android Studio. I am trying to include the play services in my project. This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "Application name"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services:fp9.0.0'
}
The only thing I have changed in this file is this line:
compile 'com.google.android.gms:play-services:fp9.0.0'
I have installed Google Play Services and it's version number is 30.
Try to add and change this in your Project Level Gradle
.
Update
classpath
com.google.gms:google-services:2.1.0
toclasspath com.google.gms:google-services:3.0.0
And
Also try to change compile
Dependencies
as below.
compile 'com.google.android.gms:play-services:9.0.0'
Or for map you can only use this.
compile 'com.google.android.gms:play-services-maps:9.0.0'
I had the same issue yesterday. In the messages section when running a gradle sync or build, I got a message with an option to update something from the M2 repo. Clicking the link downloaded the latest version and fixed the issue.
You could also try compile 'com.google.android.gms:play-services:9.0.0'
If you are only using maps, consider only downloading maps using compile 'com.google.android.gms:play-services-maps:9.0.0'
as it can save you hitting the 65K method dex limit later in development.
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.