在我的应用程序中集成 fb sdk 时,出现以下错误:
06-05 16:01:42.758: E/AndroidRuntime(892): FATAL EXCEPTION: main
06-05 16:01:42.758: E/AndroidRuntime(892): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.biz.fbapp/com.biz.fbapp.FBAppActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.facebook.android.LoginButton
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.os.Handler.dispatchMessage(Handler.java:99)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.os.Looper.loop(Looper.java:137)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-05 16:01:42.758: E/AndroidRuntime(892): at java.lang.reflect.Method.invokeNative(Native Method)
06-05 16:01:42.758: E/AndroidRuntime(892): at java.lang.reflect.Method.invoke(Method.java:511)
06-05 16:01:42.758: E/AndroidRuntime(892): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-05 16:01:42.758: E/AndroidRuntime(892): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-05 16:01:42.758: E/AndroidRuntime(892): at dalvik.system.NativeStart.main(Native Method)
06-05 16:01:42.758: E/AndroidRuntime(892): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.facebook.android.LoginButton
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-05 16:01:42.758: E/AndroidRuntime(892): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.Activity.setContentView(Activity.java:1835)
06-05 16:01:42.758: E/AndroidRuntime(892): at com.biz.fbapp.FBAppActivity.onCreate(FBAppActivity.java:53)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.Activity.performCreate(Activity.java:4465)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-05 16:01:42.758: E/AndroidRuntime(892): ... 11 more
06-05 16:01:42.758: E/AndroidRuntime(892): Caused by: java.lang.ClassNotFoundException: com.facebook.android.LoginButton
06-05 16:01:42.758: E/AndroidRuntime(892): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-05 16:01:42.758: E/AndroidRuntime(892): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-05 16:01:42.758: E/AndroidRuntime(892): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-05 16:01:42.758: E/AndroidRuntime(892): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
06-05 16:01:42.758: E/AndroidRuntime(892): ... 21 more
在这条线上
setContentView(R.layout.main);
main.xml 上的代码是
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/white"
android:gravity="center_horizontal">
<com.biz.fbapp.LoginButton
android:id="@+id/login"
android:src="@drawable/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
/>
<TextView android:id="@+id/txt"
android:text="@string/hello"
android:textColor="@drawable/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button android:id="@+id/uploadButton"
android:text="@string/upload"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/requestButton"
android:text="@string/request"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/postButton"
android:text="@string/post"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/deletePostButton"
android:text="@string/delete"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
</LinearLayout>
请告诉我我错过了什么或做错了什么来帮助我。
编辑 :
现在我得到 noclassdeffound 即使在我导入该文件后,也无法在该特定项目上添加库..
谢谢施鲁蒂