我试图从开放源代码库中隐藏apiKey和apiSecret,同时仍向Travis持续集成提供可构建的源代码。
here:在官方文档中指出,如果我具有fabric.properties,它应该可以使用:
apiKey=7dee86d.....e7f76d8e9453
apiSecret=a6cdefeb0a8f....c8a5d9fa2f5f9895931cc2
然后我可以删除...
Remove the Fabric API key element from your AndroidManifest.xml
而不是...
Add the Fabric API key to your fabric.properties: apiKey=fabric_api_key
我通常会初始化面料
Fabric.with(this, Crashlytics(), Answers())
但仍然出现异常:
E/Fabric: Failure onPreExecute()
java.lang.IllegalArgumentException: Fabric could not be initialized, API key missing from AndroidManifest.xml. Add the following tag to your Application element
<meta-data android:name="io.fabric.ApiKey" android:value="YOUR_API_KEY"/>
at io.fabric.sdk.android.services.common.ApiKey.logErrorOrThrowException(ApiKey.java:130)
at io.fabric.sdk.android.services.common.ApiKey.getValue(ApiKey.java:67)
at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:227)
at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:210)
at io.fabric.sdk.android.InitializationTask.onPreExecute(InitializationTask.java:44)
at io.fabric.sdk.android.services.concurrency.AsyncTask.executeOnExecutor(AsyncTask.java:611)
at io.fabric.sdk.android.services.concurrency.PriorityAsyncTask.executeOnExecutor(PriorityAsyncTask.java:43)
at io.fabric.sdk.android.Kit.initialize(Kit.java:69)
at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:467)
at io.fabric.sdk.android.Fabric.init(Fabric.java:411)
at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:369)
at io.fabric.sdk.android.Fabric.with(Fabric.java:340)
at renetik.android.sample.model.SampleApplication.onCreate(SampleApplication.kt:20)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/Fabric: Error dealing with settings
java.lang.IllegalArgumentException: Fabric could not be initialized, API key missing from AndroidManifest.xml. Add the following tag to your Application element
<meta-data android:name="io.fabric.ApiKey" android:value="YOUR_API_KEY"/>
at io.fabric.sdk.android.services.common.ApiKey.logErrorOrThrowException(ApiKey.java:130)
at io.fabric.sdk.android.services.common.ApiKey.getValue(ApiKey.java:67)
at io.fabric.sdk.android.services.settings.Settings.initialize(Settings.java:78)
at io.fabric.sdk.android.Onboarding.retrieveSettingsData(Onboarding.java:124)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:99)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
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)
答案 0 :(得分:0)
请确保您在build.gradle中apply plugin: 'io.fabric'
-即使您没有在调试版本中使用Fabric / Crashlytics,它仍需要运行。