NullPointer只有gplay报告

时间:2015-04-21 20:43:49

标签: java android nullpointerexception google-play

你好,我是gplay商店中的一款应用,200名玩家有2次崩溃:

这一个:

java.lang.RuntimeException: Unable to start activity ComponentInfo{ch.xyxy.datapp/ch.xyxy.datapp.MainScreen}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2313)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5336)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at ch..xyxy.datapp.MainScreen.onCreate(MainScreen.java:239)
at android.app.Activity.performCreate(Activity.java:5302)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2228)
... 11 more

这是238行​​& 239 in onCreate

  mp = MediaPlayer.create(MainScreen.this, R.raw.nova);
        mp.start(); 

和这个(这是一个玩家必须按一下按钮多次的活动)

java.lang.NullPointerException
at ch..xyxy.datapp.Game.onClick(Game.java:298)
at android.view.View.performClick(View.java:4633)
at android.view.View$PerformClick.run(View.java:19330)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5506)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)

这些是298左右的线:

MediaPlayer over1;
//....
over1 = MediaPlayer.create(this, R.raw.over1);
//....

 if(v == gameover){
 over1.start();
}

老实说,我不知道如何解决这个问题,因为在我的设备上它工作得很完美,这样我就不会因为知道它究竟发生了什么而引发这个错误。那么为什么会出现这个错误?

0 个答案:

没有答案