2013-06-27 264 views
2

我試圖啓動一個新的活動android。這是創建以下錯誤。 注:我已經更新清單中Android應用程序在嘗試啓動新活動時崩潰

logcat的新活動

06-27 18:00:39.543: D/AndroidRuntime(908): Shutting down VM 
06-27 18:00:39.543: W/dalvikvm(908): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 
06-27 18:00:39.563: E/AndroidRuntime(908): FATAL EXCEPTION: main 
06-27 18:00:39.563: E/AndroidRuntime(908): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dipl.smpm.smpm/com.dipl.smpm.smpm.UpdateTask}: android.view.InflateException: Binary XML file line #15: Error inflating class button 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.os.Handler.dispatchMessage(Handler.java:99) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.os.Looper.loop(Looper.java:123) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread.main(ActivityThread.java:4627) 
06-27 18:00:39.563: E/AndroidRuntime(908): at java.lang.reflect.Method.invokeNative(Native Method) 
06-27 18:00:39.563: E/AndroidRuntime(908): at java.lang.reflect.Method.invoke(Method.java:521) 
06-27 18:00:39.563: E/AndroidRuntime(908): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
06-27 18:00:39.563: E/AndroidRuntime(908): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
06-27 18:00:39.563: E/AndroidRuntime(908): at dalvik.system.NativeStart.main(Native Method) 
06-27 18:00:39.563: E/AndroidRuntime(908): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class button 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
06-27 18:00:39.563: E/AndroidRuntime(908): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.Activity.setContentView(Activity.java:1647) 
06-27 18:00:39.563: E/AndroidRuntime(908): at com.dipl.smpm.smpm.UpdateTask.onCreate(UpdateTask.java:11) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
06-27 18:00:39.563: E/AndroidRuntime(908): ... 11 more 
06-27 18:00:39.563: E/AndroidRuntime(908): Caused by: java.lang.ClassNotFoundException: android.view.button in loader dalvik.system.PathClassLoader[/data/app/com.dipl.smpm.smpm-2.apk] 
06-27 18:00:39.563: E/AndroidRuntime(908): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 
06-27 18:00:39.563: E/AndroidRuntime(908): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 
06-27 18:00:39.563: E/AndroidRuntime(908): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.createView(LayoutInflater.java:466) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544) 
06-27 18:00:39.563: E/AndroidRuntime(908): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66) 
06-27 18:00:39.563: E/AndroidRuntime(908): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
+4

發佈您的xml,也許是'Activity'的'onCreate()'。我也會嘗試清理你的項目 – codeMagic

+0

膨脹XML時出現錯誤。在這裏發佈XML。 –

+0

發表活動代碼。 –

回答

5

看來,你已經爲

 <button 
     android:layout_width="fill_parent" 
     .......... 

        /> 

定義的XML佈局內,您的按鈕,但你必須寫a capital b

 <Button 
     android:layout_width="fill_parent" 
     ............ 

        /> 

這就是內部錯誤信息所說的內容

Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class button <--- You wrote button, but it has to be Button 
+0

真棒.......夥計!我很着急,我掙扎了大約3天:)謝謝... @Opiatefuchs –

+0

沒問題,即使您是高級開發人員,也會發生這種情況:) – Opiatefuchs

相關問題