我有一个在 2.3 版设备和一个特定的 4.1 模拟器上完美运行的 Android 应用程序。它在其他 4.1 模拟器以及 4.1 Google Nexus 设备上崩溃。
有任何想法吗?
这与尺寸,分辨率等有关吗?
这是我在 4.1 模拟器上运行它时的 logcat 输出。实际上代码很大,所以不能把它放在这里。任何提示都会很棒。然后我可以提出所需的代码片段。
10-01 11:42:30.404: E/Trace(623): error opening trace file: No such file or directory (2)
10-01 11:42:30.754: D/dalvikvm(623): GC_FOR_ALLOC freed 126K, 3% free 8126K/8327K, paused 42ms, total 44ms
10-01 11:42:30.794: D/AndroidRuntime(623): Shutting down VM
10-01 11:42:30.794: W/dalvikvm(623): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
10-01 11:42:30.804: E/AndroidRuntime(623): FATAL EXCEPTION: main
10-01 11:42:30.804: E/AndroidRuntime(623): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.example.android_compliance/com.example.android_compliance.MainActivity}: java.lang.NullPointerException
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.os.Handler.dispatchMessage(Handler.java:99)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.os.Looper.loop(Looper.java:137)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-01 11:42:30.804: E/AndroidRuntime(623): at java.lang.reflect.Method.invokeNative(Native Method)
10-01 11:42:30.804: E/AndroidRuntime(623): at java.lang.reflect.Method.invoke(Method.java:511)
10-01 11:42:30.804: E/AndroidRuntime(623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-01 11:42:30.804: E/AndroidRuntime(623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-01 11:42:30.804: E/AndroidRuntime(623): at dalvik.system.NativeStart.main(Native Method)
10-01 11:42:30.804: E/AndroidRuntime(623): Caused by: java.lang.NullPointerException
10-01 11:42:30.804: E/AndroidRuntime(623): at com.example.android_compliance.MainActivity.onCreate(MainActivity.java:261)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.Activity.performCreate(Activity.java:5008)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
10-01 11:42:30.804: E/AndroidRuntime(623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
10-01 11:42:30.804: E/AndroidRuntime(623): ... 11 more
10-01 11:43:33.693: I/Process(623): Sending signal. PID: 623 SIG: 9