android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

StreetView Composable crashes with some locations

Open moallemi opened this issue 3 years ago • 16 comments

Environment details

  1. StreetView Composable
  2. Google Pixel 6 Pro - Android 13
  3. android:maps-compose:2.9.1 / com.google.maps.android:maps:3.4.0 / play-services-maps:18.1.0

Steps to reproduce

  1. Open StreetViewActivity in sample of this repo with this latitude=32.429634, longitude=-96.828891

Code example

The fast path to reproduce: Change current singapore

val singapore = LatLng(1.35, 103.87)

to

val singapore = LatLng(32.429634, -96.828891)

and run the sample app and navigate to Street View from Main Activity

Stack trace

com.google.maps.api.android.lib6.common.apiexception.f: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter it
	at com.google.maps.api.android.lib6.streetview.camera.i.g(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):23)
	at com.google.maps.api.android.lib6.streetview.camera.e.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):0)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7839)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter it
	at com.google.maps.android.compose.streetview.StreetViewPanoramaPropertiesNode.onAttached$lambda$3(Unknown Source:7)
	at com.google.maps.android.compose.streetview.StreetViewPanoramaPropertiesNode.$r8$lambda$u0P0-MFqw789nPtol3qohzgcP-I(Unknown Source:0)
	at com.google.maps.android.compose.streetview.StreetViewPanoramaPropertiesNode$$ExternalSyntheticLambda3.onStreetViewPanoramaChange(Unknown Source:2)
	at com.google.android.gms.maps.zzai.zzb(com.google.android.gms:play-services-maps@@18.0.0:1)
	at com.google.android.gms.maps.internal.zzbk.zza(com.google.android.gms:play-services-maps@@18.0.0:2)
	at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms:play-services-maps@@18.0.0:3)
	at android.os.Binder.transact(Binder.java:1064)
	at dw.aZ(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):2)
	at com.google.maps.api.android.lib6.streetview.camera.i.g(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):22)
	at com.google.maps.api.android.lib6.streetview.camera.e.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):0) 
	at android.os.Handler.handleCallback(Handler.java:938) 
	at android.os.Handler.dispatchMessage(Handler.java:99) 
	at android.os.Looper.loopOnce(Looper.java:201) 
	at android.os.Looper.loop(Looper.java:288) 
	at android.app.ActivityThread.main(ActivityThread.java:7839) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

Following these steps will guarantee the quickest resolution possible.

Thanks!

moallemi avatar Feb 15 '23 21:02 moallemi

If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.

@moallemi Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Feb 15 '23 21:02 wangela

I tried to open this location with google maps intent:

adb shell am start -a "android.intent.action.VIEW" -d "google.streetview:cbll=32.429634,-96.828891"

And it seems that this location is not supported by street view. So is there any way to catch the exception?

CleanShot 2023-02-15 at 13 52 34@2x

moallemi avatar Feb 15 '23 21:02 moallemi

Same issue. I'm getting same exception where there is no street details. I am looking forward to this issue being fixed.

yusufonderd avatar Mar 21 '23 21:03 yusufonderd

I've just tried StreetView. Works great but I won't use it until we can at least know if we can display the StreetView at a given location. I'll monitor this issue :)

StephenVinouze avatar Mar 22 '23 15:03 StephenVinouze

@StephenVinouze You can check the availability with streetview REST API for now

moallemi avatar Mar 22 '23 15:03 moallemi

Hi folks, @kikoso has drafted a PR for a new utility in android-maps-utils that does the work of checking whether a Street View panorama exists at the desired location, so you can call that first and only request a Street View panorama if one exists. Take a look at the issue and associated PR to comment on whether that would help in handling locations where Street View is not available.

wangela avatar Jul 26 '23 23:07 wangela

The Street View metadata util is now available in com.google.maps.android:android-maps-utils:3.5.0 to help make a free request to check existence of a Street View panorama at a given location before requesting the panorama. Usage instructions.

To resolve this bug, add a step to the Street View composable implementation to use the StreetViewUtil before requesting a panorama.

wangela avatar Aug 07 '23 23:08 wangela

Will there be a change in android-maps-compose to avoid the crash? Or show us how to catch the exception?

lawm avatar Aug 07 '23 23:08 lawm

Hi @lawm . I am leaning towards checking this from the App Level, and checking that the initial coordinate is a valid one. We will PR a solution for this soon, now that the Street View library has released a function to fix this.

kikoso avatar Aug 08 '23 03:08 kikoso

I agree wtih @kikoso's recommendation to leave the metadata check to the developer, so we keep the Compose library true to the scope of the Maps SDK and do not force high-volume, latency-inducing metadata checks in use cases where the developer is confident that the panoramas exist.

wangela avatar Oct 21 '23 19:10 wangela

:tada: This issue has been resolved in version 4.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

googlemaps-bot avatar Oct 25 '23 22:10 googlemaps-bot

Please make sure you have maps-compose-utils v3.0.0 or later and enable the Street View Static API on the project associated with your API key using the instructions at https://goo.gle/enable-sv-static-api in order to use the fetchStreetViewData method.

wangela avatar Oct 25 '23 23:10 wangela

Hi @wangela. We wanna restrict source to outdoor only. However fetchStreetViewData doesn't support it currently. Would it be possible to extend API with this option? I can create a new issue/feature request 🙂 .

amatanat avatar Oct 31 '23 09:10 amatanat

Hi @wangela. We wanna restrict source to outdoor only. However fetchStreetViewData doesn't support it currently. Would it be possible to extend API with this option? I can create a new issue/feature request 🙂 .

I already opened a pr for this: https://github.com/googlemaps/android-maps-utils/pull/1262

yusufonderd avatar Nov 02 '23 04:11 yusufonderd

@kikoso @yusufonderd @amatanat @wangela @lawm @moallemi @StephenVinouze

Hey all! i have used package flutter_google_street_view: ^3.1.4 for street view in my app, but my app getting crashes everytime by giving below error in console Process: com.cwt.tripstr, PID: 5735 E/AndroidRuntime( 5735): com.google.maps.api.android.lib6.common.apiexception.f: java.lang.NullPointerException: Parameter specified as non-null is null: method zyz.flutter.plugin.flutter_google_street_view.FlutterGoogleStreetView.onStreetViewPanoramaChange, parameter location E/AndroidRuntime( 5735): at com.google.maps.api.android.lib6.streetview.camera.i.g(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:318) E/AndroidRuntime( 5735): at com.google.maps.api.android.lib6.streetview.camera.e.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:3) E/AndroidRuntime( 5735): at android.os.Handler.handleCallback(Handler.java:959) E/AndroidRuntime( 5735): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime( 5735): at android.os.Looper.loopOnce(Looper.java:232) E/AndroidRuntime( 5735): at android.os.Looper.loop(Looper.java:317) E/AndroidRuntime( 5735): at android.app.ActivityThread.main(ActivityThread.java:8699) E/AndroidRuntime( 5735): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 5735): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) E/AndroidRuntime( 5735): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) E/AndroidRuntime( 5735): Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method zyz.flutter.plugin.flutter_google_street_view.FlutterGoogleStreetView.onStreetViewPanoramaChange, parameter location E/AndroidRuntime( 5735): at zyz.flutter.plugin.flutter_google_street_view.FlutterGoogleStreetView.onStreetViewPanoramaChange(Unknown Source:2)

Does anyone have solution for this? App is crashing also even streetview is available

yogeshButani avatar Sep 30 '24 07:09 yogeshButani

@yogeshButani, this thread is for android-maps-compose. Could you report this issue in the correct repository instead? https://github.com/zyzdev/flutter_street_view

Also, please refrain from tagging everyone in the thread, as it violates basic netiquette. Thanks!

kikoso avatar Sep 30 '24 07:09 kikoso