Android - 当我将原始文件添加到声音文件时,我的应用程序崩溃的原因是什么原因?

时间:2014-06-16 23:55:40

标签: android audio crash

当我尝试打开时,我的应用程序崩溃。我所做的唯一更改是将.ogg文件添加到我的res / raw目录中。这真的很奇怪。我没有添加任何代码或进行任何其他更改。我只是将一个声音文件拖入raw并编译。它只是一直说“不幸的是,已经停止了”。我应该检查一些明显的事情吗?

MainActivity.onCreate:

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.engine_layout);
        myEngineView = (EngineView) findViewById(R.id.engineviewid);
        myEngineView.setKeepScreenOn(true);
    }

我在logcat中得到了这个:

E/AndroidRuntime(12560): FATAL EXCEPTION: main
E/AndroidRuntime(12560): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.thing/com.example.thing.MainActivity}: java.lang.NullPointerException
E/AndroidRuntime(12560):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
E/AndroidRuntime(12560):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
E/AndroidRuntime(12560):    at android.app.ActivityThread.access$600(ActivityThread.java:149)
E/AndroidRuntime(12560):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
E/AndroidRuntime(12560):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(12560):    at android.os.Looper.loop(Looper.java:153)
E/AndroidRuntime(12560):    at android.app.ActivityThread.main(ActivityThread.java:4987)
E/AndroidRuntime(12560):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12560):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(12560):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
E/AndroidRuntime(12560):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
E/AndroidRuntime(12560):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(12560): Caused by: java.lang.NullPointerException
E/AndroidRuntime(12560):    at com.example.thing.MainActivity.onCreate(MainActivity.java:18)
E/AndroidRuntime(12560):    at android.app.Activity.performCreate(Activity.java:5020)
E/AndroidRuntime(12560):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(12560):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime(12560):    ... 11 more
E/AppErrorDialog(  338): Failed to get ILowStorageHandle instance
E/Trace   (12585): error opening trace file: No such file or directory (2)
E/AndroidRuntime(12585): FATAL EXCEPTION: main
E/AndroidRuntime(12585): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.thing/com.example.thing.MainActivity}: java.lang.NullPointerException
E/AndroidRuntime(12585):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
E/AndroidRuntime(12585):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
E/AndroidRuntime(12585):    at android.app.ActivityThread.access$600(ActivityThread.java:149)
E/AndroidRuntime(12585):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
E/AndroidRuntime(12585):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(12585):    at android.os.Looper.loop(Looper.java:153)
E/AndroidRuntime(12585):    at android.app.ActivityThread.main(ActivityThread.java:4987)
E/AndroidRuntime(12585):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12585):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(12585):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
E/AndroidRuntime(12585):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
E/AndroidRuntime(12585):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(12585): Caused by: java.lang.NullPointerException
E/AndroidRuntime(12585):    at com.example.thing.MainActivity.onCreate(MainActivity.java:18)
E/AndroidRuntime(12585):    at android.app.Activity.performCreate(Activity.java:5020)
E/AndroidRuntime(12585):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(12585):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime(12585):    ... 11 more

0 个答案:

没有答案