2016-10-13 13 views
0

私のアプリにFacebookの共有を統合しようとしています。私のアプリにFacebookの共有を統合する

私はこのガイドを、次の午前:

にリンク

Add Facebook Activity - Include this in AndroidManifest.xml

Add Facebook Activity Link

なしでは、それは言うまで

https://developers.facebook.com/docs/sharing/android

すべてが細かい行ってきましたそのページは私にhを伝えます私のアプリにアクティビティを追加する。

私はそれをしたビデオを見つけましたが、私はアクティビティを追加してそれを実行しようとするビデオにあるコードを入力します(自動的にdoesntします)。私はエラーを取得する:

Error:Execution failed for task ':app:processReleaseManifest'. 
> Manifest merger failed : Attribute activity#[email protected] value=(@android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:27:15-74 
    is also present at [com.facebook.android:facebook-android-sdk:4.16.0] AndroidManifest.xml:32:13-63 value=(@style/com_facebook_activity_theme). 
    Suggestion: add 'tools:replace="android:theme"' to <activity> element at AndroidManifest.xml:26:5-30:17 to override. 

私は他のすべてのように行っている:私のマニフェストに

<meta-data 
    android:name="com.facebook.sdk.ApplicationId" 
    android:value="@string/facebook_id"/> 
<provider 
    android:name="com.facebook.FacebookContentProvider" 
    android:authorities="com.facebook.app.FacebookContentProvider12345678" 
    android:exported="true"/> 

をして:

private void share() { 
ShareLinkContent content = new ShareLinkContent.Builder() 
     .setContentTitle("This is the title") 
     .setContentDescription("This is the description") 
     .setContentUrl(Uri.parse("www.google.com")) 
     .build(); 

ShareDialog.show(getActivity(), content); 
} 

を単なるテストとして、それが共有画面をロードし、私が指定した情報と、数秒後にクラッシュする情報はありませんか?

どうすればよいですか?

答えて

3

AndroidManifest.xmlファイルにFacebookアクティビティを追加する必要があります。

<activity android:name="com.facebook.FacebookActivity" /> 
+0

私はこれを試してみましたが、それはあなたのマニフェストのアプリケーションタグ アンドロイドでこれを試してみてください – x10sion

+0

上記で述べたlogcatエラーで作業をdoesntの記事で言ったように:ラベル=「@文字列/ APP_NAME」 ツール:置き換えます= "android:label" –

+0

私の仕事 –

1

com.facebook.FacebookActivityと一緒にマニフェストで独自のFacebookの活動を追加します。

<activity android:name=".activity.FbActivity" /> 
    <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" /> 
0

ツールを追加:replace = "android:theme" run ok。

<activity android:name="com.facebook.FacebookActivity"   android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" 
     android:theme="@android:style/Theme.Translucent.NoTitleBar" 
     tools:replace="android:theme" 
     android:label="@string/app_name" /> 
関連する問題