java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by HARSHIL JAIN
, 1 year ago
Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
at com.example.android.miwok.NumbersActivity$1.onItemClick(NumbersActivity.java:46)
at android.widget.AdapterView.performItemClick(AdapterView.java:310)
at android.widget.AbsListView.performItemClick(AbsListView.java:1188)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3231)
at android.widget.AbsListView.onTouchUp(AbsListView.java:4176)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:3887)
at android.view.View.dispatchTouchEvent(View.java:8593)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2513)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2157)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2484)
at android.view.View.dispatchPointerEvent(View.java:8799)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4662)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4520)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4087)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4053)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4190)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4061)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4247)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4087)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4053)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4061)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6463)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6437)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6390)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6622)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:148)
at android.os.Looper.loop(Looper.java:151)
at android.app.ActivityThread.main(ActivityThread.java:5649)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.