對不起,新手問題的傢伙。我剛接觸android,正在努力在新的應用程序中設置一些登錄系統。一切正常(很長一段時間後),我有一個登錄按鈕從主頁面的菜單,這只是一個空的「你好世界」的默認活動。然後我決定刪除「hello world」文本視圖,我試圖立即運行它,並且應用程序與null異常崩潰。我瘋狂地做ctrl + z,但應用程序一直在崩潰。 我明白從logcat中絕對沒有:突然我的android應用程序崩潰
10-24 00:10:17.982:I/ActivityManager(59):啓動活動:意向{ 行爲= android.intent.action.MAIN貓= [機器人.intent.category.LAUNCHER] FLG = 0x10200000 CMP = com.application.mySoSpecialApplication/.MainActivity} 10-24 00:10:18.002:W /窗口管理(59):{HistoryRecord 4505f618 com.application.mySoSpecialApplication/.MainActivity}無法創建 開始窗口10-24 00:10:18.002:W/WindowManager(59): java.lang.RuntimeException:二進制XML文件行#25:您必須提供 佈局_height屬性。 10-24 00:10:18.002:W/WindowManager(59): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491) 10-24 00:10:18.002:W/WindowManager(59 ):at android.view.ViewGroup $ LayoutParams.setBaseAttributes(ViewGroup.java:3593) 10-24 00:10:18.002:W/WindowManager(59):at android.view.ViewGroup $ MarginLayoutParams。(ViewGroup。 java:3672) 10-24 00:10:18.002:W/WindowManager(59):at android.widget.LinearLayout $ LayoutParams。(LinearLayout.java:1395) 10-24 00:10:18.002:W/WindowManager(59):at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1321) 10-24 00:10:18.002:W/WindowManager(59):at an droid.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45) 10-24 00:10:18.002:W/WindowManager(59):at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)10-24 00:10:18.002:W/WindowManager(59):at android.view.LayoutInflater.inflate(LayoutInflater.java:407)10-24 00:10:18.002:W/WindowManager(59):at android .view.LayoutInflater.inflate(LayoutInflater.java:320)10-24 00:10:18.002:W/WindowManager(59):at android.view.LayoutInflater.inflate(LayoutInflater.java:276)10-24 00:10:18.002:W/WindowManager(59):at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2165) 10-24 00:10:18.002:W/WindowMan ager(59):at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2220) 10-24 00:10:18.002:W/WindowManager(59):at com.android。 internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1407) 10-24 00:10:18.002:W/WindowManager(59):at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager .java:894) 10-24 00:10:18.002:W/WindowManager(59):at com.android.server.WindowManagerService $ H.handleMessage(WindowManagerService.java:9007) 10-24 00:10: 18.002:W/WindowManager(59):at android.os.Handler.dispatchMessage(Handler.java:99)10-24 00:10:18.002:W/WindowManager(59):at android.os.Loo per.loop(Looper.java:123)10-24 00:10:18.002: W/WindowManager(59):at com.android.server.WindowManagerService $ WMThread.run(WindowManagerService.java:570) 10- 24 00:10:18.042:I/ActivityManager(59):啓動proc com.application。活動的mySoSpecialApplication com.application.mySoSpecialApplication/.MainActivity:pid = 463 uid = 10036 gids = {3003} 10-24 00:10:18.272:D/AndroidRuntime(463): 關閉VM 10-24 00: 10:18.272:W/dalvikvm(463):threadid = 1: 線程以未捕獲的異常退出(group = 0x4001d800)10-24 00:10:18.292:E/AndroidRuntime(463):致命例外:main 10-24 00:10:18.292:E/AndroidRuntime(463):了java.lang.RuntimeException: 無法實例應用 com.application.mySoSpecialApplication.mySoSpecialApplicationApplication: 顯示java.lang.NullPointerException 10-24 00:10:18.292: E/AndroidRuntime(463):在 android.app.ActivityThread $ PackageInfo.m akeApplication(ActivityThread.java:649) 10-24 00:10:18.292:E/AndroidRuntime(463):at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232) 10-24 00:10:18.292 :E/AndroidRuntime(463):at android.app.ActivityThread.access $ 3000(ActivityThread.java:125)10-24 00:10:18.292:E/AndroidRuntime(463):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2071) 10-24 00:10:18.292:E/AndroidRuntime(463):at android.os.Handler.dispatchMessage(Handler.java:99)10-24 00:10 :18.292:E/AndroidRuntime(463):at android.os.Looper.loop(Looper.java:123)10-24 00:10:18.292: E/AndroidRuntime(463):在 android.app.ActivityThread.main(ActivityThread.java:4627)10-24 00:10:18.292:E/AndroidRuntime(463):at java.lang.reflect.Method.invokeNative(Native Method)10-24 00:10:18.292:E/AndroidRuntime(463):at java.lang.reflect.Method.invoke(Method.java:521)10-24 00:10:18.292: E/AndroidRuntime(463):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868) 10-24 00:10:18.292:E/AndroidRuntime(463):at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:626)10-24 00:10:18.292:E/AndroidRuntime(463):at dalvik.system.NativeStart.main(Native Method)10-24 00:10:18.292: E/AndroidRuntime (463):由java.lang.NullPoi引起nterException 10-24 00:10:18.292:E/AndroidRuntime(463):at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90) 10-24 00:10:18.292:E/AndroidRuntime(463) :at com.application.mySoSpecialApplication.mySoSpecialApplicationApplication。(mySoSpecialApplicationApplication.java:14) 10-24 00:10:18.292:E/AndroidRuntime(463):at java.lang.Class.newInstanceImpl(Native Method)10- 24 00:10:18.292: E/AndroidRuntime(463):at java.lang.Class.newInstance(Class.java:1429)10-24 00:10:18.292: E/AndroidRuntime(463):at android.app.Instrumentation.newApplication(Instrumentation.java:957) 10-24 00:10:18.292:E/AndroidRuntime(463):at android.app.Instrumentation.newApplication(Instrumentation.java:942) 10-24 00:10:18.292:E/AndroidRuntime(463):at android.app.ActivityThread $ PackageInfo.makeApplication(ActivityThread.java:644) 10-24 00:10:18.292:E/AndroidRuntime(463):... 11更多10-24 00:10:18.312:W/ActivityManager(59):強制結束活動 com.application.mySoSpecialApplication /。 MainActivity 10-24 00:10:18.968:W/ActivityManager(59):10:21.322:用於 HistoryRecord {4505f618 com.application.mySoSpecialApplication/.MainActivity} 10-24 00活動暫停超時I /過程( 463):發送信號。 PID:463 SIG:9 10-24 00:10:21。352:I/ActivityManager(59):進程 com.application.mySoSpecialApplication(pid 463)已經死亡。 10-24 00:10:21.383:W/InputManagerService(59):窗口已經聚焦, 忽略聚焦增益: [email protected] 10-24 00:10 :29.087:W/ActivityManager(59):活動破壞超時 HistoryRecord {4505f618 com.application.mySoSpecialApplication/.MainActivity}
也許你們中的一個人就會找出問題出在哪裏。非常感謝你。
讀取logcat輸出的方法是查找最後一個「由」引起的堆棧跟蹤。在這種情況下,當您從mySoSpecialApplicationApplication.java的第14行調用它時,logcat表示您在'getContentResolver'內部有一個NullPointerException。您需要發佈相關代碼才能獲得更多幫助。 :) –
或'二進制XML文件行#25:您必須提供layout_height屬性'。 –
@DaveNewton - 是的,可能就是這樣。試圖混淆代碼後,我得到一個更可怕的logcat –