question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

androidx: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.brightcove.player.util.LifecycleUtil.onActivityCreated(android.os.Bundle)' on a null object reference

See original GitHub issue

Using the androidx appcompat dependency and BrightcovePlayerFragment, app crashes with the following NPE:

java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.brightcove.player.util.LifecycleUtil.onActivityCreated(android.os.Bundle)’ on a null object reference at com.brightcove.player.appcompat.BrightcovePlayerFragment.onActivityCreated(BrightcovePlayerFragment.java:78) at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2460) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1483) at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852) at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3269) at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229) at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:201) at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:620) at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391) at android.app.Activity.performStart(Activity.java:7157) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2937) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)`

Example: https://github.com/mihaelaLo/BrightcoveErrorApplication

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liveHarshitcommented, Jul 22, 2020

@BCjwhisenant Thanks for the update. But I’m still getting the following error while extending BrightcovePlayerFragment to the fragment:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.brightcove.player.util.LifecycleUtil.onActivityCreated(android.os.Bundle)' on a null object reference

With "com.brightcove.player:android-appcompat-plugin:6.10.0" Any help?

0reactions
HasanElHefnawycommented, Jun 17, 2022

@droider91 in this sample,

  1. replace BrightcovePlayerFragment with Fragment.
  2. replace baseVideoView with an instance of BrightcoveExoPlayerVideoView.
Read more comments on GitHub >

github_iconTop Results From Across the Web

androidx: java.lang.NullPointerException: Attempt to invoke virtual ...
NullPointerException : Attempt to invoke virtual method 'void com.brightcove.player.util.LifecycleUtil.onActivityCreated(android.os.Bundle)' on a null object ...
Read more >
java.lang.NullPointerException: Attempt to invoke virtual ...
Your app is crashing at: welcomePlayer.setText("Welcome Back, " + String.valueOf(mPlayer.getName(this)) + " !"); because mPlayer=null .
Read more >
Class BrightcovePlayerFragment
Returns the BrightcoveVideoView to it's original layout parameters and restores the ActionBar. void, onActivityCreated​(android.os.Bundle savedInstanceState).
Read more >
Caused by java.lang.NullPointerException Attempt to invoke ...
Attempt to invoke virtual method 'void com.newrelic.agent.android.tracing.TraceMachine.completeActivityTrace()' on a null object ...
Read more >
Attempt to invoke virtual method on a null object reference kotlin
String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference. Attempt to invoke virtual method 'void com.facebook.login.widget ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found