I am trying to create a new class in an Android project but keep getting the following error:
error: package com.google.android.gms.maps.model does not exist
I have installed Google Play Services
in the SDK manager. Any idea how to fix this?
Android dev noob here
Add this to your gradle file
compile "com.google.android.gms:play-services-maps:10.0.1"
For me, I started by discovering that upgrading my gradle was not going as planned, as I was importing from jcenter, which apparently only goes up to 2.3. I modified my buildscript by adding google() to my build.gradle as follows:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
Next I found that it was importing com.google.android.gms multiple times, so when it told me that "compile" was obsolete, I had to change everything to either "implementation" or "api". For the maps and location services I used "api", in order to avoid the duplication errors, and that fixed it for me without changing the play services number.
dependencies {
api 'com.google.android.gms:play-services-location:9.6.1'
api 'com.google.android.gms:play-services-maps:9.6.1'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With