请帮我.我只是想用谷歌地图做这件事,我不想使用任何第三方地图.
DisplayMetrics displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int height = displayMetrics.heightPixels; int width = displayMetrics.widthPixels; LatLngBounds bounds = new LatLngBounds(new LatLng(lat,lng),new LatLng(lat,lng)); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds,width,height,20));
Logcat:
07-02 05:20:35.409 32739-665/com.example E/AndroidRuntime: FATAL
EXCEPTION: GLThread 19450
Process: com.example,PID: 32739
java.lang.StackOverflowError: stack size 1037KB
at com.google.maps.api.android.lib6.common.i.(:com.google.android.gms.dynamite_dynamitemodulesb@12685025@12.6.85
(040408-197041431):9)
解决方法
https://issuetracker.google.com/issues/35829548
来自Google的最后一条消息是2018年6月25日
We’ll actually keep using this issue for instances of this crash where indoor maps are disabled,sorry for the confusion.
We are currently internally testing a fix for this issue and will add it to the updates pipeline once it’s ready. Due to the timing of release cycles,we still recommend disabling indoor maps as best short-term workaround for now if you or your users are heavily affected. We will post an update here when the fix for this issue is rolled-out.
尝试按照他们的建议并设置googleMap.setIndoorEnabled(false);作为一种解决方法.
更新
好消息. Google于2018年10月20日将该错误标记为已修复.此外,Google Play服务中最新版Google地图Android SDK的发行说明中也提到了此错误
https://developers.google.com/maps/documentation/android-sdk/releases#october_18_2018