Android SDK Facebook登录按钮错误

问题描述:

我想安装Facebook登录按钮到我的Android应用程序。我使用的AndroidSDK并获得以下错误:Android SDK Facebook登录按钮错误

10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: FATAL EXCEPTION: main 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: Process: com.example.frederik.testpleasework, PID: 2218 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.frederik.testpleasework/com.example.frederik.testpleasework.MainActivity}: android.view.InflateException: Binary XML file line #18: Binary XML file line #12: Error inflating class com.facebook.login.widget.LoginButton 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #18: Binary XML file line #12: Error inflating class com.facebook.login.widget.LoginButton 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:539) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.example.frederik.testpleasework.MainActivity.onCreate(MainActivity.java:19) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Activity.performCreate(Activity.java:6237) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.-wrap11(ActivityThread.java)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class com.facebook.login.widget.LoginButton 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:831) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.example.frederik.testpleasework.MainActivity.onCreate(MainActivity.java:19)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Activity.performCreate(Activity.java:6237)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.-wrap11(ActivityThread.java)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Constructor.newInstance(Native Method) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.example.frederik.testpleasework.MainActivity.onCreate(MainActivity.java:19)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Activity.performCreate(Activity.java:6237)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.-wrap11(ActivityThread.java)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime: Caused by: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.internal.Validate.sdkInitialized(Validate.java:136) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.AccessTokenTracker.<init>(AccessTokenTracker.java:55) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.login.widget.LoginButton$2.<init>(LoginButton.java:561) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.login.widget.LoginButton.configureButton(LoginButton.java:561) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.FacebookButtonBase.<init>(FacebookButtonBase.java:66) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.facebook.login.widget.LoginButton.<init>(LoginButton.java:200) 
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Constructor.newInstance(Native Method)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createView(LayoutInflater.java:619)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.example.frederik.testpleasework.MainActivity.onCreate(MainActivity.java:19)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Activity.performCreate(Activity.java:6237)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.-wrap11(ActivityThread.java)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
10-14 16:08:24.733 2218-2218/com.example.frederik.testpleasework E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  

我已经设置了用自己的方式: enter image description here

(插入的所有其他信息一样好,但我相信这是何等的相关)

有一个想法的错误可能在于我的表现,我会提供藏汉:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.frederik.testpleasework" > 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

清除后互联网的解决方案我自己的错误想法可能是FB页面上的错误设置或清单中的错误代码。但是我还没有设法找到它,并希望你们能够提供帮助。

在此先感谢您=)

+0

的原因是在你的堆栈跟踪:'造成的:该SDK尚未初始化,确保首先调用FacebookSdk.sdkInitialize()。“ –

+0

尝试输入代码后,出现错误:无法解析方法”sdkInitialize()“。也许我把它错了? =) – KrownScripter

我认为以下将帮助你。 1)在super.on创建后,将您的Facebook代码初始化。 setcontent视图之前。

@Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     FacebookSdk.sdkInitialize(getApplicationContext()); 
     setContentView(R.layout.activity_main); 
} 

2)其次你没有定义清单中的Facebook活动。

<activity android:name="com.facebook.FacebookActivity" 
      android:configChanges= 
       "keyboard|keyboardHidden|screenLayout|screenSize|orientation" 
      android:theme="@android:style/Theme.Translucent.NoTitleBar" 
      android:label="@string/app_name" /> 

3)还添加元数据为您facebbok应用程序ID清单中

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fbid"/> 

您的清单想的是:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.solution.sa.myfb" > 

    <uses-permission android:name="android.permission.INTERNET"/> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme" > 
     <activity android:name=".MainActivity" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity android:name="com.facebook.FacebookActivity" 
      android:configChanges= 
       "keyboard|keyboardHidden|screenLayout|screenSize|orientation" 
      android:theme="@android:style/Theme.Translucent.NoTitleBar" 
      android:label="@string/app_name" /> 

     <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fbid"/> 

    </application> 



</manifest> 

仍然有任何问题,请随时问: - )

enter image description here

可以在串类添加自己的Facebook ID这样的:连你

<string name="fbid">your fb id</string> 

图像帮助

+0

元数据给我一个错误。我假设我必须使用fb提供的ID,但是我得到一个关于它无法解析的错误@ string/id – KrownScripter

+0

在字符串类中定义您的Facebook应用程序Id如下所示: 1628325584101650

+0

我是在活动内部还是在元行之前定义它?而不是我必须键入它像“android:name”,而不只是名称? =) – KrownScripter