Google play services maps 9.2.0 issue - android

My Android app has been successfully using maps by including the following in my gradle ...
compile project(':googleplayservices_lib')
My SDK manager says I have rev 32 which appears to be the latest. So with this, everything has been working just fine.
Now I'm enhancing the app and I saw some posts that says I can now use zIndex parameter when adding a marker to control the Z Index. But to do this I must add the following to my gradle . . .
compile 'com.google.android.gms:play-services-maps:9.2.0'
So now my gradle file has this dependencies section . . .
dependencies {
compile project(':library')
compile project(':googleplayservices_lib')
compile files('libs/gson-2.2.4.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
}
Now I'm able to set zIndex but this new version apparently comes with breaking changes. For instance the following no longer works . . .
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
map is a GoogleMap. The compiler cannot resolve the getMap() method. My problem is that I can't seem to locate the documentation on this new maps revision where it discusses breaking changes for this new version. Does anyone know where I can find such information?

My Android app has been successfully using maps by including the following in my gradle
Presumably, that is an in-project copy of the old Eclipse library project edition of the Play Services SDK. Ideally, you would have moved off of that to the Play Services SDK artifacts back when you moved to Android Studio.
My SDK manager says I have rev 32 which appears to be the latest
Since you are using a local in-project copy, what the SDK Manager reports is not directly relevant.
Also, Google has not been maintaining that library project for at least the past several months, so "latest" of that library is meaningless with respect to using the latest version of the Play Services SDK.
So now my gradle file has this dependencies section . . .
I am surprised that compiles. Remove compile project(':googleplayservices_lib'). If you are using parts of the Play Services SDK beyond Maps V2, use appropriate and compatible artifacts for those APIs as well.
The compiler cannot resolve the getMap() method.
getMap() was deprecated about 20 months ago, in favor of getMapAsync().
My problem is that I can't seem to locate the documentation on this new maps revision where it discusses breaking changes for this new version.
Maps V2 release notes are in the Play Services documentation. A subset of Maps V2 release notes are incorporated in the overall Play Services release notes.

Related

Which library should I use for Location when using google maps?

I have the following library for the google maps and it works fine
implementation 'com.google.android.gms:play-services-maps:16.1.0'
But when I try to add this one for location,
implementation 'com.google.android.gms:play-services-location:16.1.0'
the following error occurs
Failed to resolve: com.google.android.gms:play-services-location:16.1.0
Which library for the location should I use?
THANK YOU.
You will get latest gradle dependencies here
https://developers.google.com/android/guides/setup
It is probably because 16.1.0 does not exist for this library. Google Play Services libraries do not always have the same version. So maps might be on 16.1.0 but location might not even have this version.
To get the latest versions, check the official release page: https://developers.google.com/android/guides/releases
And as you are just starting, make sure to use the latest ones:
com.google.android.gms:play-services-location:17.0.0
com.google.android.gms:play-services-maps:17.0.0
Yes, it is a coincident that those versions are currently the same. As you can see in the list there are already libraries on 19.0.0, like appindexing
com.google.firebase:firebase-appindexing:19.0.0
Edit
A small practical tip: If you replace the version by + and sync the project, gradle will get the newest one and afterwards you can use the IDE warning to replace the + again with the newest version number. That eases a bit the checking on different pages if there is a new version or not etc

PlaceAutocompleteFragment can't resolved

In my app I have added Google Maps and they work fine. I want to add a PlaceAutocompleteFragment. I am using the key which I had already generate for maps and I have enable the option Places Api from google.console. I have added these to my build.gradle:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
but when I try to use PlacesAutoCompleteFragment then Android Studio can't resolve this.
The problem here is that PlaceAutocompleteFragment didn't exist in version 8.3 of Google Play Services.
This isn't documented very well, but you can see on this blog that PlaceAutocompleteFragment was "announced" in December 2015.
You can also see in the PlaceCompleteFragment Google code samples on GitHub that they are using version 8.4 of GooglePlayServices.
I also had this problem, and updating Google Play Services is what made it work.
So, update Google Play Services in the SDK Manager, and then modify the build.gradle like so, and it should work:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
Update
In newer versions of Google Play Services, they have broken out the Google Places API, so you need to include it in addition to Maps and Location:
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'

Android studio build gradle sync failed

I am trying to add google play service to my project but it gives me error when I try to edit build (Gradle).
How can I fix it?
In your configuration there some issues.
You are using the wrong build.gradle file.
It is your top-level file.
You should add this line in your app/build.gradle
There is a typo. You are missing the ' at the end of the line compile.
Use an updated version.
For example use:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:8.1.0'
}
Finally refer this official doc for more info.
In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.
For example if you need to make only your app aware of location updates add
compile 'com.google.android.gms:play-services-location:8.1.0' only in gradle or if you need only map choose compile 'com.google.android.gms:play-services-maps:8.1.0'.
Please replace
compile 'com.google.android.gms:play-services:3.1.36
with
compile 'com.google.android.gms:play-services:3.1.36'
One thing you can try is Right Click on app open module settings on Dependencies Tab click '+' icon and add there 'com.google.android.gms:play-services:8.1.0' and click search icon and add that dependency,
So i don't want to elaborate what you had done wrong as my colleagues figured it out.I like to say, while playing with Google Play Service
Selectively compile APIs into your executable
In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.
For example if you need to make only your app aware of location
updates add compile
'com.google.android.gms:play-services-location:8.1.0' only in gradle
or if you need only map choose compile
'com.google.android.gms:play-services-maps:8.1.0'.
Thank you.
Visit for more.

Android studio, Google Maps: V2 maps not fully loaded

Me and my team have a problem on google maps in Android Studio. The maps showed is able to zooming up to a certain point. After maps remains pixelated (zooming up maps does not loading). We have tested in many devices, in a tablet for example some maps regions are not exactly showed: there are many gray squares.
The same code for the maps that working in another project, imported in our project has this strange behavior (We have tested both in wifi and cellular data network).
We are followed step by step google develeoper guide.
We have this configuration:
android studio 1.1.0
min sdk 16
target sdk 21
Gradle conf:
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
This is a screenshot of my situation: http://oi59.tinypic.com/vra3o2.jpg
I have resolved. The problem was in gradle. I'm using aviary and its dependecy from okhttp blocked google maps loading.
This are line added under dependencies:
compile('com.adobe.creativesdk:image:4.0.0') {
exclude group: "com.squareup.okhttp"
}
...
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'

How to handle priorities between Gradle local dependencies?

I'm currently having an issue in my Android project based on Gradle. My project has two dependencies:
compile project(':Library:lib1')
compile files('libs/libGoogleAnalyticsServices.jar')
libGoogleAnalyticsServices is version v3 for google analytics.
the problem is that lib1 is an old library depending on version v2 of google analytics:
compile files('libs/libGoogleAnalyticsV2.jar')
At the end there's a conflict between both jars (even if v2 should be only visible by lib1) and v2 is taking over v3. In my main module I'm having missing references.
So two problems:
Why is v2 even visible from the main module?
Why is v2 taking over v3?
Ideally I'd like to keep v2 only visible from my lib1 and v3 only visible from my main module.
Any idea?
I don't know much about Android, but I would assume that the situation is the same as for standard Java applications: You can only use one version of a particular library per application, and have to make sure that all code that ships with your application is compatible with that version.

Categories

Resources