简体   繁体   English

React Native Android应用程序要求调用已弃用的'FacebookSdk.sdkInitialize'

[英]React Native Android app asking to call deprecated 'FacebookSdk.sdkInitialize'

React-Native v. 0.47.2 react-native-fbsdk v. 0.6.0/0.6.1 React-Native v.0.47.2 react-native-fbsdk v.6.0.0 / 0.6.1

I need to get Facebook login setup for an app. 我需要为应用程序获取Facebook登录设置。 It's been a real struggle on Android. 这在Android上是一场真正的挣扎。 When you install via the Facebook docs ( here then through the quickstart) and run your program this is the first error that pops up: 当你通过Facebook文档安装( 这里通过快速入门)并运行你的程序时,这是弹出的第一个错误:

/Users/Parthenon/Desktop/go3/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

As per this thread I've tried explicitly stating the version in react-native-fbsdk gradle at: 根据这个线程,我尝试在react-native-fbsdk gradle中明确说明版本:

compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.facebook.android:facebook-android-sdk:4.22.1'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'

With anything but version 4.22.1 I get the above error. 除了版本4.22.1我得到上述错误。 For version 4.22.1 the project builds which is awesome but then it throws the error: 对于版本4.22.1 ,项目构建很棒,但然后它会抛出错误:

The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.

This is really strange because FacebookSdk.sdkInitialize() was deprecated well before 4.22 . 这真的很奇怪,因为FacebookSdk.sdkInitialize()4.22之前就被弃用了。 If I call that method the app runs then crashes. 如果我调用该方法应用程序运行然后崩溃。 But it crashes with no error log. 但它没有错误日志崩溃。

What's going on here or what should I try next? 这里发生了什么或接下来应该尝试什么?

I have the same issue and I realize that I have to complete all steps to configure the native facebook sdk for android. 我有同样的问题,我意识到我必须完成所有步骤来配置Android的原生facebook sdk。 Its mean you need to have a facebook account for this work. 这意味着你需要有一个facebook帐户来完成这项工作。 What you need to do next is: 你接下来要做的是:

  1. In your project open yourapp/android/build.gradle 在你的项目中打开yourapp/android/build.gradle

  2. Add the Maven Central Repository to build.gradle before dependencies: 在依赖项之前将Maven Central Repository添加到build.gradle:

    repositories { mavenCentral() }

  3. Add compile 'com.facebook.android:facebook-android-sdk:[4,5)' to your build.gradle dependencies compile 'com.facebook.android:facebook-android-sdk:[4,5)'添加到build.gradle依赖项中

  4. Build project 建立项目

  5. Open your strings.xml file, for example: /app/src/main/res/values/strings.xml. 打开strings.xml文件,例如: /app/src/main/res/values/strings.xml. and add <string name="facebook_app_id">xxxxxxxx</string> 并添加<string name="facebook_app_id">xxxxxxxx</string>

  6. Open your AndroidManifest.xml and add <uses-permission android:name="android.permission.INTERNET"/> 打开AndroidManifest.xml并添加<uses-permission android:name="android.permission.INTERNET"/>

  7. Add meta to application element <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> 添加meta到应用程序元素<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

  8. Generate a development key hash 生成开发密钥哈希

You can see detail in quick start of developer facebook page (developers.facebook.com/quickstarts/) 您可以在开发者Facebook页面的快速入门中看到详细信息(developers.facebook.com/quickstarts/)

暂无
暂无

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

相关问题 FacebookSdk.sdkInitialize(getApplicationContext())已弃用 - FacebookSdk.sdkInitialize(getApplicationContext()) Deprecated FacebookSdk.sdkInitialize (Context) 已弃用 - FacebookSdk.sdkInitialize (Context) is deprecated 有必要每次都调用FacebookSdk.sdkInitialize()吗? - It is necessary to call FacebookSdk.sdkInitialize() each time? 集成Facebook Android SDK 4.4.0后,应用程序在FacebookSdk.SdkInitialize()上崩溃了吗? - App crashing at FacebookSdk.SdkInitialize() after integrating Facebook Android SDK 4.4.0? 错误:请确保先调用FacebookSdk.sdkInitialize() - Error: Make sure to call FacebookSdk.sdkInitialize() first FacebookSdk.sdkInitialize-调用一次,还是每次活动调用一次? - FacebookSdk.sdkInitialize - call it once, or once per activity? FacebookSdk.sdkInitialize(getApplicationContext())方法不起作用 - FacebookSdk.sdkInitialize(getApplicationContext()) method not worked facebook AppInviteContent:SDK尚未初始化,请务必先调用FacebookSdk.sdkInitialize() - facebook AppInviteContent: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first SDK尚未初始化,请务必先调用FacebookSdk.sdkInitialize() - The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first Android: java.lang.NoSuchMethodError: Landroid\\/os\\/Handler 当调用 FacebookSdk.sdkInitialize() - Android: java.lang.NoSuchMethodError: Landroid\/os\/Handler when calling FacebookSdk.sdkInitialize()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM