2013-03-23 161 views
0

我正在開發一個應用程序項目,但突然間它總是立即崩潰。我不知道原因。這裏的崩潰日誌:應用程序崩潰在調試模式下突然崩潰請參閱崩潰日誌

03-24 00:16:27.050: E/AndroidRuntime(533): FATAL EXCEPTION: main 
03-24 00:16:27.050: E/AndroidRuntime(533): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lexoffice.android/com.lexoffice.android.Login}: android.view.InflateException: Binary XML file line #54: Error inflating class android.widget.Button 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread.access$600(ActivityThread.java:123) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.os.Handler.dispatchMessage(Handler.java:99) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.os.Looper.loop(Looper.java:137) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread.main(ActivityThread.java:4424) 
03-24 00:16:27.050: E/AndroidRuntime(533): at java.lang.reflect.Method.invokeNative(Native Method) 
03-24 00:16:27.050: E/AndroidRuntime(533): at java.lang.reflect.Method.invoke(Method.java:511) 
03-24 00:16:27.050: E/AndroidRuntime(533): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
03-24 00:16:27.050: E/AndroidRuntime(533): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
03-24 00:16:27.050: E/AndroidRuntime(533): at dalvik.system.NativeStart.main(Native Method) 
03-24 00:16:27.050: E/AndroidRuntime(533): Caused by: android.view.InflateException: Binary XML file line #54: Error inflating class android.widget.Button 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 
03-24 00:16:27.050: E/AndroidRuntime(533): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
03-24 00:16:27.050: E/AndroidRuntime(533): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.Activity.setContentView(Activity.java:1835) 
03-24 00:16:27.050: E/AndroidRuntime(533): at com.lexoffice.android.Login.onCreate(Login.java:21) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.Activity.performCreate(Activity.java:4465) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 
03-24 00:16:27.050: E/AndroidRuntime(533): ... 11 more 
03-24 00:16:27.050: E/AndroidRuntime(533): Caused by: java.lang.reflect.InvocationTargetException 
03-24 00:16:27.050: E/AndroidRuntime(533): at java.lang.reflect.Constructor.constructNative(Native Method) 
03-24 00:16:27.050: E/AndroidRuntime(533): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 
03-24 00:16:27.050: E/AndroidRuntime(533): ... 26 more 
03-24 00:16:27.050: E/AndroidRuntime(533): Caused by: android.content.res.Resources$NotFoundException: File res/layout/activity_login.xml from color state list resource ID #0x7f030000 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.content.res.Resources.loadColorStateList(Resources.java:2053) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.content.res.TypedArray.getColorStateList(TypedArray.java:342) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.widget.TextView.<init>(TextView.java:782) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.widget.Button.<init>(Button.java:108) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.widget.Button.<init>(Button.java:104) 
03-24 00:16:27.050: E/AndroidRuntime(533): ... 29 more 
03-24 00:16:27.050: E/AndroidRuntime(533): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag ScrollView 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:146) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.content.res.ColorStateList.createFromXml(ColorStateList.java:129) 
03-24 00:16:27.050: E/AndroidRuntime(533): at android.content.res.Resources.loadColorStateList(Resources.java:2050) 
03-24 00:16:27.050: E/AndroidRuntime(533): ... 33 more 
+0

有些事情錯在這裏產生的原因:android.content.res.Resources $ NotFoundException:從顏色狀態列表 – 2013-03-23 23:25:28

+1

文件RES /佈局/ activity_login.xml請張貼涉及XML資源文件 – Goddchen 2013-03-23 23:26:36

回答

1

您的應用在onCreate()失敗當它試圖訪問你的XML文件中定義的Button對象之一。根據我的經驗,當您在R.id.whatever值中指定錯誤的資源ID時,此故障可能發生在findViewById()中。

如果一切都檢查出來,通常一個完整的刷新,清理和重建可以解決這個問題。

+0

嘿大衛!你保存我的項目。 activity_login.xml中有一個未指定的屬性。它來自圖形佈局 - 設置。有時候最好是編碼而不是使用wizzards ... – user1735856 2013-03-24 08:38:34