Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreetView Composable crashes with some locations #265

Closed
moallemi opened this issue Feb 15, 2023 · 14 comments · Fixed by #435
Closed

StreetView Composable crashes with some locations #265

moallemi opened this issue Feb 15, 2023 · 14 comments · Fixed by #435
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. released type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@moallemi
Copy link

moallemi commented Feb 15, 2023

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@214218113@21.42.18 (190400-0):23)
	at com.google.maps.api.android.lib6.streetview.camera.e.run(:com.google.android.gms.dynamite_mapsdynamite@214218113@21.42.18 (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@214218113@21.42.18 (190400-0):2)
	at com.google.maps.api.android.lib6.streetview.camera.i.g(:com.google.android.gms.dynamite_mapsdynamite@214218113@21.42.18 (190400-0):22)
	at com.google.maps.api.android.lib6.streetview.camera.e.run(:com.google.android.gms.dynamite_mapsdynamite@214218113@21.42.18 (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 moallemi added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 15, 2023
@wangela
Copy link
Member

wangela commented Feb 15, 2023

If you would like to upvote the priority of this issue, please comment below or react with 👍 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.

@moallemi
Copy link
Author

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

@yusufonderd
Copy link

yusufonderd commented Mar 21, 2023

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

@StephenVinouze
Copy link

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 :)

@moallemi
Copy link
Author

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

@kikoso kikoso added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed triage me I really want to be triaged. labels Jul 10, 2023
lawm added a commit to lawm/android-maps-compose that referenced this issue Jul 22, 2023
The example given crashes (googlemaps#265). Changed location to match BasicMapActivity.kt, which works.
lawm added a commit to lawm/android-maps-compose that referenced this issue Jul 22, 2023
The example given crashes (googlemaps#265). Changed location to match BasicMapActivity.kt, which works.
@wangela
Copy link
Member

wangela commented Jul 26, 2023

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
Copy link
Member

wangela commented Aug 7, 2023

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.

@lawm
Copy link
Contributor

lawm commented Aug 7, 2023

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

@kikoso
Copy link
Collaborator

kikoso commented Aug 8, 2023

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.

@wangela
Copy link
Member

wangela commented Oct 21, 2023

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.

@googlemaps-bot
Copy link
Contributor

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@wangela
Copy link
Member

wangela commented Oct 25, 2023

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.

@amatanat
Copy link

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 🙂 .

@yusufonderd
Copy link

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: googlemaps/android-maps-utils#1262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. released type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants