Google play services maps 9.2.0 issue

心已入冬 提交于 2019-12-12 03:37:49

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/38817358/google-play-services-maps-9-2-0-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!