简体   繁体   English

致命异常-启动时应用崩溃

[英]FATAL EXCEPTION MAIN - App crashes on startup

When I run my app I get this error, how should I fix this error, any ideas will be appreciated. 当我运行我的应用程序时,出现此错误,该如何解决该错误,我们将不胜感激。

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)

From the log, it seems LoginButton class is not available which is supposed to be under package com.facebook.widget: 从日志中,似乎LoginButton类不可用,该类应该在com.facebook.widget包下:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.widget.LoginButton" on path: /data/app/com.example.my_autrui-1.apk 原因:java.lang.ClassNotFoundException:在路径:/data/app/com.example.my_autrui-1.apk上找不到类“ com.facebook.widget.LoginButton”

Are you using a third party library? 您正在使用第三方库吗? You need to add that as a dependency and make sure that while exporting the library is packaged as well. 您需要将其添加为依赖项,并确保在导出库时也将其打包。

For adding dependency on a third party, right click on the project and select Properties -> Java Build Path -> Libraries Tab. 要添加对第三方的依赖关系,请右键单击该项目,然后选择“ 属性”->“ Java构建路径”->“库”选项卡。 To check if the libraries are getting exported, in the same window check Order and Export tab. 要检查库是否正在导出,请在同一窗口中检查“ 订购和导出”选项卡。 Make sure the Android Private Libraries are added and selected to be exported. 确保已添加并选择要导出的Android私有库

The problem is the package name of the button. 问题是按钮的包装名称。

Check the comments here: 在此处查看评论:

Error inflating class com.facebook.widget.LoginButton with Facebook SDK 4.0.1 使用Facebook SDK 4.0.1膨胀类com.facebook.widget.LoginButton时出错

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM