我完成了我的应用并开始在其他设备上进行测试。我自己的设备是HTC One M7,它的工作正常。然后我在三星Galaxy S4上测试了它,显示了前2个布局,但是当我启动GameActivity时它会崩溃。在模拟的Nexus 7上也是如此。 但是在ldpi模拟器上它工作正常。
这是我在Nexus 7上遇到的错误。
12-31 11:27:55.755: E/AndroidRuntime(1514): FATAL EXCEPTION: main
12-31 11:27:55.755: E/AndroidRuntime(1514): Process: com.example.test, PID: 1514
12-31 11:27:55.755: E/AndroidRuntime(1514): java.lang.OutOfMemoryError
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:445)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:475)
12-31 11:27:55.755: E/AndroidRuntime(1514): at com.example.test.GameView.<init>(GameView.java:93)
12-31 11:27:55.755: E/AndroidRuntime(1514): at com.example.test.GameActivity.onResume(GameActivity.java:49)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.Activity.performResume(Activity.java:5310)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2778)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2817)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.os.Handler.dispatchMessage(Handler.java:102)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.os.Looper.loop(Looper.java:136)
12-31 11:27:55.755: E/AndroidRuntime(1514): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-31 11:27:55.755: E/AndroidRuntime(1514): at java.lang.reflect.Method.invokeNative(Native Method)
12-31 11:27:55.755: E/AndroidRuntime(1514): at java.lang.reflect.Method.invoke(Method.java:515)
12-31 11:27:55.755: E/AndroidRuntime(1514): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-31 11:27:55.755: E/AndroidRuntime(1514): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-31 11:27:55.755: E/AndroidRuntime(1514): at dalvik.system.NativeStart.main(Native Method)
任何人都可以告诉我为什么它在2台设备上工作而在其他2台设备上失败了吗?