gpt4 book ai didi

java - android: Facebook SDK AsyncTask 错误

转载 作者:行者123 更新时间:2023-11-29 07:02:20 24 4
gpt4 key购买 nike

这个问题一直困扰着我。我花了很多时间来解决这个问题但失败了。首先,我使用的是最新的 SDK(版本 22)。

每当我通过 Preferences>Android>Library 将 Facebook 添加到我的项目时,我会在控制台中收到错误消息。

[2014-06-03 15:15:04 - Test] Found 3 versions of android-support-v4.jar in the dependency list,
[2014-06-03 15:15:04 - Test] but not all the versions are identical (check is based on SHA-1 only at this time).
[2014-06-03 15:15:04 - Test] All versions of the libraries must be the same at this time.
[2014-06-03 15:15:04 - Test] Versions found are:
[2014-06-03 15:15:04 - Test] Path: /home/bipin/NewProjectsWorkspace/Test/libs/android-support-v4.jar
[2014-06-03 15:15:04 - Test] Length: 648327
[2014-06-03 15:15:04 - Test] SHA-1: ded9acc6a9792b8f1afc470f0c9cd36d178914cd
[2014-06-03 15:15:04 - Test] Path: /home/bipin/Desktop/facebook-android-sdk-3.14.1/facebook/libs/android-support-v4.jar
[2014-06-03 15:15:04 - Test] Length: 621451
[2014-06-03 15:15:04 - Test] SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4
[2014-06-03 15:15:04 - Test] Path: /home/bipin/NewProjectsWorkspace/appcompat_v7/libs/android-support-v4.jar
[2014-06-03 15:15:04 - Test] Length: 648327
[2014-06-03 15:15:04 - Test] SHA-1: ded9acc6a9792b8f1afc470f0c9cd36d178914cd
[2014-06-03 15:15:04 - Test] Jar mismatch! Fix your dependencies

然后我尝试将 android-support-v4.jar 文件从 Facebook 的 libs 文件夹替换到我的测试项目和 appcompat_v7 项目。这在 logcat 中显示以下错误:

06-03 15:20:29.101: E/AndroidRuntime(14303): FATAL EXCEPTION: AsyncTask #1
06-03 15:20:29.101: E/AndroidRuntime(14303): java.lang.RuntimeException: An error occured while executing doInBackground()
06-03 15:20:29.101: E/AndroidRuntime(14303): at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
06-03 15:20:29.101: E/AndroidRuntime(14303): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.lang.Thread.run(Thread.java:841)
06-03 15:20:29.101: E/AndroidRuntime(14303): Caused by: java.lang.NullPointerException
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:911)
06-03 15:20:29.101: E/AndroidRuntime(14303): at com.facebook.internal.Utility.queryAppSettings(Utility.java:372)
06-03 15:20:29.101: E/AndroidRuntime(14303): at com.facebook.widget.LoginButton$1.doInBackground(LoginButton.java:676)
06-03 15:20:29.101: E/AndroidRuntime(14303): at com.facebook.widget.LoginButton$1.doInBackground(LoginButton.java:1)
06-03 15:20:29.101: E/AndroidRuntime(14303): at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-03 15:20:29.101: E/AndroidRuntime(14303): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-03 15:20:29.101: E/AndroidRuntime(14303): ... 4 more

在我的Activity 中没有与AsyncTask 相关的内容。我猜它与 FB SDK 有关。任何人都可以帮助解决这个问题..

最佳答案

我正要开始赏金,我正在检查 HelloFacebookSample 并决定试一试。

我将我的应用程序 ID 设置为:

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

但它应该是什么:

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

我从没想过这会造成这样的错误。我想他们应该把这个作为警告放在他们的教程中!

关于java - android: Facebook SDK AsyncTask 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24011849/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com