{"id":1237,"date":"2023-03-18T09:28:22","date_gmt":"2023-03-18T01:28:22","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1237"},"modified":"2023-04-29T09:33:37","modified_gmt":"2023-04-29T01:33:37","slug":"android-access-facebook-login-record","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/18\/android-access-facebook-login-record\/","title":{"rendered":"Android\u63a5\u5165Facebook\u767b\u5f55\u8e29\u5751\u8bb0\u5f55"},"content":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developers.facebook.com\/docs\/facebook-login\/android\">https:\/\/developers.facebook.com\/docs\/facebook-login\/android<\/a><\/p>\n<h3>Facebook SDK<\/h3>\n<p>Facebook SDK\u5305\u542b<\/p>\n<p><!-- more --><\/p>\n<ul>\n<li>facebook-core<\/li>\n<li>facebook-common<\/li>\n<li>facebook-login<\/li>\n<li>facebook-share<\/li>\n<li>facebook-places<\/li>\n<li>facebook-applinks<\/li>\n<li>facebook-marketing<\/li>\n<li>facebook-messenger<\/li>\n<li>notifications<\/li>\n<li>AccountKit<\/li>\n<\/ul>\n<p>\u5b9e\u73b0\u767b\u5f55\u529f\u80fd\u81f3\u5c11\u9700\u8981<\/p>\n<ul>\n<li>facebook-core<\/li>\n<li>facebook-common<\/li>\n<li>facebook-login<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u5206\u522b\u5f15\u5165core\u3001common\u3001login\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5f15\u5165facebook-android-sdk<\/p>\n<h3>Atlas Bundle\u4e2d\u5f15\u7528Facebook SDK<\/h3>\n<p>\u5982\u4f7f\u7528Atlas\u8fdc\u7a0bBundle\u5f62\u5f0f\u52a0\u8f7d\uff0c\u5219AndroidManifest.xml\u4e2d\u7684<code>facebook_app_id<\/code>\u548c<code>fb_login_protocol_scheme<\/code>\u4e0d\u80fd\u5305\u542bBundle\u5185\u90e8\u7684string\u7b49\u8d44\u6e90\uff0c\u5426\u5219\u5bfc\u81f4AndroidManifest.xml\u4f1a\u88abmerge\u5230host\u4e2d\uff0c\u4f46string.xml\u4e0d\u4f1a\uff0c\u4ece\u800c\u627e\u4e0d\u5230\u8d44\u6e90<\/p>\n<pre><code>app\\build\\intermediates\\manifests\\full\\debug\\AndroidManifest.xml:73: error: Error: No resource found that matches the given name (at &#039;value&#039; with value &#039;@string\/facebook_app_id&#039;).\n\napp\\build\\intermediates\\manifests\\full\\debug\\AndroidManifest.xml:74: error: Error: No resource found that matches the given name (at &#039;theme&#039; with value &#039;@style\/com_facebook_activity_theme&#039;).\n\napp\\build\\intermediates\\manifests\\full\\debug\\AndroidManifest.xml:82: error: Error: No resource found that matches the given name (at &#039;scheme&#039; with value &#039;@string\/fb_login_protocol_scheme&#039;).<\/code><\/pre>\n<h4><code>value<\/code>\u548c<code>scheme<\/code><\/h4>\n<p>\u82e5\u5728AndroidManifest.xml\u4e2d\u76f4\u63a5\u5c06<code>value<\/code>\u548c<code>scheme<\/code>\u7528<code>facebook_app_id<\/code>\u548c<code>fb_login_protocol_scheme<\/code>\u7684\u503c\u5199\u6b7b<\/p>\n<pre><code>App Ids cannot be directly placed in the manifest.They must be prefixed by &#039;fb&#039; or be placed in the string resource file.<\/code><\/pre>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u5c06<code>facebook_app_id<\/code>\u548c<code>fb_login_protocol_scheme<\/code>\u653e\u5728\u516c\u5171module\u7684\u8d44\u6e90\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u5728AndroidManifest.xml\u4e2d\u5f15\u7528<\/p>\n<pre><code class=\"language-xml\">&lt;string name=&quot;facebook_app_id&quot;&gt;2147844112xxxxxx&lt;\/string&gt;\n&lt;string name=&quot;fb_login_protocol_scheme&quot;&gt;fb2147844112xxxxxx&lt;\/string&gt;<\/code><\/pre>\n<h4><code>theme<\/code><\/h4>\n<p>FacebookActivity\u9700\u8981\u6307\u5b9a\u516c\u5171\u7684Theme\uff0c\u7ed9FacebookActivity\u66f4\u6362Theme\u53ef\u80fd\u4f1a\u51fa\u73b0\u51b2\u7a81\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ed9Activity\u6dfb\u52a0<code>tools:replace=&quot;android:theme&quot;<\/code>\u89e3\u51b3\u3002<\/p>\n<pre><code class=\"language-xml\">&lt;activity android:name=&quot;com.facebook.FacebookActivity&quot;\n    android:configChanges=&quot;keyboard|keyboardHidden|screenLayout|screenSize|orientation&quot;\n    android:label=&quot;@string\/app_name&quot;\n    tools:replace=&quot;android:theme&quot;\n    android:theme=&quot;@android:style\/Theme.Translucent.NoTitleBar&quot;\n    \/&gt;<\/code><\/pre>\n<h3>CardView\u8d44\u6e90\u627e\u4e0d\u5230<\/h3>\n<p>Facebook SDK\u5185\u7f6eCardView\uff0c\u82e5\u5916\u90e8\u518d\u6b21\u5f15\u7528\u4f1a\u62a5\u7248\u672c\u51b2\u7a81\u6216\u627e\u4e0d\u5230\u8d44\u6e90<\/p>\n<pre><code>app\\build\\intermediates\\awb-res\\merged\\debug\\me.yezhou.lib-social\\layout\\com_facebook_device_auth_dialog_fragment.xml:22: error: No resource identifier found for attribute &#039;cardElevation&#039; in package &#039;me.yezhou.lib.social&#039;\nNo resource identifier found for attribute &#039;cardBackgroundColor&#039; in package &#039;me.yezhou.lib.social&#039;<\/code><\/pre>\n<h3>zxing\u4f9d\u8d56\u51b2\u7a81<\/h3>\n<p>facebook-android-sdk\u5305\u542bcom.google.zxing.core\u4e8c\u7ef4\u7801\u626b\u63cf\u4f9d\u8d56\uff0c\u5982\u516c\u5171module\u6216\u5176\u4ed6bundle\u4e5f\u4f9d\u8d56zxing\uff0c\u6ce8\u610f\u51b2\u7a81<\/p>\n<h3>Gradle\u4f9d\u8d56<\/h3>\n<pre><code class=\"language-java\">dependencies {\n\/\/    compile(&#039;com.facebook.android:facebook-core:4.36.1&#039;, {\n\/\/        exclude group: &#039;com.android.support&#039;\n\/\/    })\n\/\/    compile(&#039;com.facebook.android:facebook-common:4.36.1&#039;, {\n\/\/        exclude group: &#039;com.android.support&#039;\n\/\/    })\n\/\/    compile(&#039;com.facebook.android:facebook-login:4.36.1&#039;, {\n\/\/        exclude group: &#039;com.android.support&#039;\n\/\/    })\n    compile(&#039;com.facebook.android:facebook-android-sdk:4.36.1&#039;, {\n        \/\/exclude group: &#039;com.android.support&#039;\n        exclude group: &#039;com.android.support&#039;, module: &#039;appcompat&#039;\n        exclude group: &#039;com.google.zxing&#039;\n    })\n}<\/code><\/pre>\n<h3>\u6240\u63d0\u4f9b\u7684\u7f51\u5740\u4e0d\u88ab\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6240\u63a5\u7eb3<\/h3>\n<pre><code>\u6240\u63d0\u4f9b\u7684\u7f51\u5740\u4e0d\u88ab\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6240\u63a5\u7eb3\u3002: One or more of the given URLs is not allowed by the App&#039;s settings. To use this URL you must add a valid native platform in your App&#039;s settings.<\/code><\/pre>\n<p>\u5c06\u8f6f\u4ef6\u5305\u540d\u79f0\u4e0e\u5e94\u7528\u7684\u9ed8\u8ba4\u7c7b\u5173\u8054<\/p>\n<p>\u5730\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developers.facebook.com\/docs\/facebook-login\/android#5\">https:\/\/developers.facebook.com\/docs\/facebook-login\/android#5<\/a>&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<h3>Invalid key hash<\/h3>\n<pre><code>Invalid key hash. The key hash xxx does not match any stored key hashs. Configure your app key hashes at https:\/\/developers.facebook.com\/apps\/2147844112xxxxxx<\/code><\/pre>\n<p>\u4e3a\u5e94\u7528\u63d0\u4f9b\u5f00\u53d1\u548c\u53d1\u5e03\u5bc6\u94a5\u6563\u5217<\/p>\n<pre><code>keytool -exportcert -alias androiddebugkey -keystore &quot;C:\\Users\\yezhou\\.android\\debug.keystore&quot; | &quot;C:\\OpenSSL-Win64\\bin\\openssl&quot; sha1 -binary | &quot;C:\\OpenSSL-Win64\\bin\\openssl&quot; base64\n\u8f93\u5165\u5bc6\u94a5\u5e93\u53e3\u4ee4:  \/\/\u6ce8\u610f\u4e0d\u8981\u8f93\u5165\u53e3\u4ee4\uff0c\u4e3a\u7a7a\u5373\u53ef<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/developers.facebook.com\/docs\/facebook-logi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[238],"class_list":["post-1237","post","type-post","status-publish","format-standard","hentry","category-android-basic","tag-facebook"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1237"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1237\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}