Crash when sharing screen

Description

We are getting the following crash (in production) whenever a user attempts to share their screen during a meeting. The crash is 100% reproducible.


java.lang.RuntimeException: Unable to create service com.zipow.videobox.share.ScreenShareServiceForSDK
at android.app.ActivityThread.handleCreateService(ActivityThread.java:5590)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2759)
at android.os.Handler.dispatchMessageImpl(Handler.java:142)
at android.os.Handler.dispatchMessage(Handler.java:125)
at android.os.Looper.loopOnce(Looper.java:269)
at android.os.Looper.loop(Looper.java:367)
at android.app.ActivityThread.main(ActivityThread.java:9333)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getString(int)' on a null object reference
at us.zoom.proguard.kf8.d(ZmVendorUtils.java:2)
at us.zoom.proguard.kf8.e(ZmVendorUtils.java:1)
at us.zoom.proguard.zy6.o(ZmConfigOptionUtils.java:1)
at com.zipow.videobox.VideoBoxApplication.getInstance(VideoBoxApplication.java:1)
at com.zipow.videobox.share.ScreenShareServiceForSDK.onCreate(ScreenShareServiceForSDK.java:3)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:5579)
... 10 more

Which Android Meeting SDK version?
7.0.0.38589

To Reproduce(If applicable)

Select Share > Screen > Share entire screen

Screenshots

(When attempting to add screenshots, I get an error message that I can’t attach media items.)

Troubleshooting Routes

We’re not doing any client-side manipulation of screen sharing.

Smartphone (please complete the following information):

~82% Samsung phones, 11% Motorola, and a handful of other manufacturers. Approximately 67% of those users are on Android 16.

Additional context

We have several thousand of these crashes in the past couple of months, but have been unable to find an issue with our integration.

@ChrisM Thank you for posting on our dev forum. We might need more information to investigate this crash. Had you set it enableGenerateDumpto true when initializing the SDK? Also, is there more crash dumps other than the one you provided? If there’s more crash info, please share it with us. Thank you

I enabled that flag and did the repro steps again. This is what it logs with the flag enabled:

java.lang.RuntimeException: Unable to start service com.zipow.videobox.share.ScreenShareServiceForSDK@5300281 with Intent { xflg=0x4 cmp=com...mobile/com.zipow.videobox.share.ScreenShareServiceForSDK (has extras) }
	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5765)
	at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2811)
	at android.os.Handler.dispatchMessageImpl(Handler.java:142)
	at android.os.Handler.dispatchMessage(Handler.java:125)
	at android.os.Looper.loopOnce(Looper.java:269)
	at android.os.Looper.loop(Looper.java:367)
	at android.app.ActivityThread.main(ActivityThread.java:9333)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Caused by: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{c5a429a 4302:com...mobile/u0a470} targetSDK=36 requires permissions: all of the permissions [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] and any of the permissions [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media] or Media projection screen capture permission 
	at android.os.Parcel.createExceptionOrNull(Parcel.java:3370)
	at android.os.Parcel.createException(Parcel.java:3354)
	at android.os.Parcel.readException(Parcel.java:3337)
	at android.os.Parcel.readException(Parcel.java:3279)
	at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7509)
	at java.lang.reflect.Method.invoke(Native Method)
	at leakcanary.ServiceWatcher$install$4$2.invoke(ServiceWatcher.kt:93)
	at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
	at $Proxy13.setServiceForeground(Unknown Source)
	at android.app.Service.startForeground(Service.java:862)
	at us.zoom.sdk.SDKNotificationMgr.showConfNotificationForSDK(SDKNotificationMgr.java:132)
	at com.zipow.videobox.share.ScreenShareServiceForSDK.b(ScreenShareServiceForSDK.java:31)
	at com.zipow.videobox.share.ScreenShareServiceForSDK.a(ScreenShareServiceForSDK.java:21)
	at com.zipow.videobox.share.ScreenShareServiceForSDK.onStartCommand(ScreenShareServiceForSDK.java:22)
	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5749)
	... 10 more

Looks like FOREGROUND_SERVICE_MEDIA_PROJECTION is missing; if I explicitly declare this permission in the manifest then screen sharing works.

Is there a way to disable the screen sharing button for users in a meeting? I ask because I am not keen to go through the Google Play approval process for adding the missing permission.

@ChrisM Please follow the description from ourr official doc to disable the service. Integrate with your app - Meeting SDK - Zoom Developer Docs Thank you

When I followed those steps, I started seeing this crash:


Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getString(int)' on a null object reference
at us.zoom.proguard.kf8.d(ZmVendorUtils.java:2)
at us.zoom.proguard.kf8.e(ZmVendorUtils.java:1)
at us.zoom.proguard.zy6.o(ZmConfigOptionUtils.java:1)
at com.zipow.videobox.VideoBoxApplication.getInstance(VideoBoxApplication.java:1)
at com.zipow.videobox.share.ScreenShareServiceForSDK.onCreate(ScreenShareServiceForSDK.java:3)

This is what those integration docs currently say to add when screensharing is not wanted:

If the screen sharing feature is not included in your project, add this code in Androidmanifest.xml to remove the service and permissions.


<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" tools:node="remove" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" tools:node="remove" />
<service
    android:name="com.zipow.videobox.share.ScreenShareServiceForSDK"
    android:exported="false"
    android:foregroundServiceType="microphone|connectedDevice"
    tools:replace="android:foregroundServiceType"
    android:label="Zoom"/>

The screen sharing option is gone from the UI, but intermittently the app will crash with that NullPointerException at app start.