FATAL EXCEPTION MAIN - 应用程序在启动时崩溃

时间:2014-03-11 22:19:21

标签: java android eclipse

当我运行我的应用程序时,我收到此错误,我应该如何解决此错误,任何想法将不胜感激。

03-11 18:15:35.795: E/AndroidRuntime(5588): FATAL EXCEPTION: main
03-11 18:15:35.795: E/AndroidRuntime(5588): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.my_autrui/com.example.my_autrui.Login}: android.view.InflateException: Binary XML file line #64: Error inflating class com.facebook.widget.LoginButton
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread.access$600(ActivityThread.java:150)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.os.Looper.loop(Looper.java:137)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread.main(ActivityThread.java:5195)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at java.lang.reflect.Method.invokeNative(Native Method)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at java.lang.reflect.Method.invoke(Method.java:511)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at dalvik.system.NativeStart.main(Native Method)
03-11 18:15:35.795: E/AndroidRuntime(5588): Caused by: android.view.InflateException: Binary XML file line #64: Error inflating class com.facebook.widget.LoginButton
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:282)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.Activity.setContentView(Activity.java:1881)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at com.example.my_autrui.Login.onCreate(Login.java:26)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.Activity.performCreate(Activity.java:5104)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
03-11 18:15:35.795: E/AndroidRuntime(5588):     ... 11 more
03-11 18:15:35.795: E/AndroidRuntime(5588): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.widget.LoginButton" on path: /data/app/com.example.my_autrui-1.apk
03-11 18:15:35.795: E/AndroidRuntime(5588):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.createView(LayoutInflater.java:552)
03-11 18:15:35.795: E/AndroidRuntime(5588):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)

2 个答案:

答案 0 :(得分:1)

从日志中看,似乎LoginButton类不可用,它应该在com.facebook.widget包下:

  

引起:java.lang.ClassNotFoundException:没有找到类   路径上的“com.facebook.widget.LoginButton”:   /data/app/com.example.my_autrui-1.apk

您使用的是第三方图书馆吗?您需要将其添加为依赖项,并确保在导出库时也打包。

要添加对第三方的依赖性,请右键单击该项目并选择属性 - > Java构建路径 - >图书馆标签。 要检查库是否已导出,请在同一窗口中选中订购和导出选项卡。确保添加并选择 Android私有库以进行导出。

答案 1 :(得分:0)

问题是按钮的包名。

点击此处的评论:

the documentation