我已经设法在我的Android应用程序中实现了Twitter登录。一切正常,所以我只是想保持清洁。
现在我只需要使用Login with Twitter功能,所以我按照此处指示的说明进行操作:https://dev.twitter.com/twitter-kit/android/twittercore
正如我所说,一切正常,但每次我的应用程序启动时都会出现以下错误:
E/Fabric ( 8859): Error dealing with settings
E/Fabric ( 8859): java.lang.IllegalArgumentException: Fabric could not be initialized, API key missing from AndroidManifest.xml. Add the following tag to your Application element
E/Fabric ( 8859): <meta-data android:name="io.fabric.ApiKey" android:value="YOUR_API_KEY"/>
E/Fabric ( 8859): at io.fabric.sdk.android.services.common.ApiKey.logErrorOrThrowException(ApiKey.java:93)
E/Fabric ( 8859): at io.fabric.sdk.android.services.common.ApiKey.getValue(ApiKey.java:44)
E/Fabric ( 8859): at io.fabric.sdk.android.services.settings.Settings.initialize(Settings.java:68)
E/Fabric ( 8859): at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:80)
E/Fabric ( 8859): at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:26)
E/Fabric ( 8859): at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:46)
E/Fabric ( 8859): at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:11)
E/Fabric ( 8859): at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:294)
E/Fabric ( 8859): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/Fabric ( 8859): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
E/Fabric ( 8859): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/Fabric ( 8859): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/Fabric ( 8859): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/Fabric ( 8859): at java.lang.Thread.run(Thread.java:818)
我尝试使用我的应用程序的使用者密钥在我的清单文件中添加该值,然后我收到以下错误:
3-24 13:34:38.451 10250-10268/... E/Fabric﹕ Unknown error while loading Crashlytics settings. Crashes will be cached until settings can be retrieved.
org.json.JSONException: No value for app
at org.json.JSONObject.get(JSONObject.java:389)
at org.json.JSONObject.getJSONObject(JSONObject.java:609)
at io.fabric.sdk.android.services.settings.DefaultSettingsJsonTransform.buildFromJson(DefaultSettingsJsonTransform.java:24)
at io.fabric.sdk.android.services.settings.DefaultSettingsController.loadSettingsData(DefaultSettingsController.java:66)
at io.fabric.sdk.android.services.settings.DefaultSettingsController.loadSettingsData(DefaultSettingsController.java:47)
at io.fabric.sdk.android.services.settings.Settings.loadSettingsData(Settings.java:139)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:80)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:26)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:46)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:11)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:294)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
我不明白为什么我得到这个错误,如果一切正常,这个价值显然不是我预期的目的,所以我不知道Twitter是否在后台做了额外的事情。除此之外,它没有在文档中的任何地方提及我需要在清单中提供该值以便使用Twitter登录。
更新:我在Twitter社区中提出了同样的问题。答案是“Twitter工具包是建立在Fabric之上的,因此需要API密钥才能与Fabric设置进行通信”。在我的意见中,除了登录之外,这仍然没有回答我关于Twitter做什么的问题。但我想如果它建立在Fabric之上,那可以归结为一些遗留问题,它正在尝试为Fabric平台做一些必要的工作,这对于登录来说是不必要的。更多信息:https://twittercommunity.com/t/twitter-login-working-fine-but-keeps-asking-api-key-android/34383/3
答案 0 :(得分:0)
看起来你需要为Crashlytics定义一些设置,其中一个是app
属性。看起来你正在使用Crashlytics所属的Fabric。