PictureInPicture - Java - Sample Application Crashes

Open
#75 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
Clearly specified
Activity status
Stale
Tech stack
android, java
Domain
mobile-dev

Research direction

Start in MainActivity.java at adjustFullScreen on line 313, reached from onWindowFocusChanged on line 241. Reproduce the crash by checking out the PictureInPicture sample and running it in an Android 11 or Android 9 emulator. Done means the sample starts and changes window focus without the reported NullPointerException.

Written by the indexing model from the issue text.

Description

The sample application crashes when checkout the repository and run the project PictureInPicture in emulator with following crash log:

2021-06-07 16:44:27.046 9271-9271/com.example.android.pictureinpicture E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.android.pictureinpicture, PID: 9271
    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:1701)
        at android.view.View.dispatchWindowFocusChanged(View.java:14448)
        at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1491)
        at android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:3216)
        at android.view.ViewRootImpl.access$1100(ViewRootImpl.java:188)
        at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4999)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7464)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
2021-06-07 16:44:27.233 9271-9291/com.example.android.pictureinpicture W/MediaPlayerNative: info/warning (3, 0)

Tried on Emulator with Android 11.0 and Android 9.0
Android Studio 4.1.3
Build #AI-201.8743.12.41.7199119, built on March 11, 2021
Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true
Non-Bundled Plugins: com.intellij.marketplace, org.jetbrains.kotlin

Kindly ignore if it's a mistake or duplicate issue!
Let me know if you need any more information.

Thanks.

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.