java.lang.NullPointerException: after deploying Picture in Picture sample on devices

Open
#87 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, kotlin
Domain
mobile-dev

Research direction

Start in MainActivity.java at adjustFullScreen (line 313) and trace its call from onWindowFocusChanged (line 241). Reproduce the Picture in Picture sample on an API 30 Pixel 3 XL after updating Gradle and AGP, then verify deployment no longer produces the reported NullPointerException in Logcat.

Written by the indexing model from the issue text.

Description

Steps
  1. Open Picture in Picture sample In Electric Eel Patch 2 build or Flamingo RC builds
  2. Update gradle and AGP versions
  3. Try to deploy on the device (I used API 30 Pixel 3 XL)
Actual :

I see below exception in Logcat after deployment

023-03-23 12:13:40.932 28748-28748 AndroidRuntime          com...mple.android.pictureinpicture  E  FATAL EXCEPTION: main
                                                                                                    Process: com.example.android.pictureinpicture, PID: 28748
                                                                                                    java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.core.view.WindowInsetsControllerCompat.show(int)' on a null object reference
                                                                                                    	at com.example.android.pictureinpicture.MainActivity.adjustFullScreen(MainActivity.java:313)
                                                                                                    	at com.example.android.pictureinpicture.MainActivity.onWindowFocusChanged(MainActivity.java:241)
                                                                                                    	at androidx.appcompat.view.WindowCallbackWrapper.onWindowFocusChanged(WindowCallbackWrapper.java:124)
                                                                                                    	at com.android.internal.policy.DecorView.onWindowFocusChanged(DecorView.java:1692)
                                                                                                    	at android.view.View.dispatchWindowFocusChanged(View.java:13703)
                                                                                                    	at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1480)
                                                                                                    	at android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:2870)
                                                                                                    	at android.view.ViewRootImpl.access$1100(ViewRootImpl.java:142)
                                                                                                    	at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4533)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                                                    	at android.os.Looper.loop(Looper.java:214)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7356)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2023-03-23 12:13:40.949 28748-28748 Process                 com...mple.android.pictureinpicture  I  Sending signal. PID: 28748 SIG: 9
2023-03-23 12:13:40.961  1388-1703  InputDispatcher         system_process                       E  channel '264e43a com.example.android.pictureinpicture/com.example.android.pictureinpicture.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
Dominant language
Kotlin
Stars
1.4k
Forks
777
Avg merge
1m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/media-samples

All issues in android/media-samples

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.