Crashlytics Error. This app is based on Crashlytics. Please register to access

I have two build options in gradle, but for some reason, when I change the following flag to false, I get the error message header:

ext.enableCrashlytics = false 

the error itself is completed below:

 Process: com.mobile.myapp.staging, PID: 5439 java.lang.RuntimeException: Unable to create application com.mobile.myapp.UI.myappApplication: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, install an Android build tool and ask a team member to invite you to this app organization. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, install an Android build tool and ask a team member to invite you to this app organization. at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:234) at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:207) 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:440) at io.fabric.sdk.android.Fabric.init(Fabric.java:384) at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:342) at io.fabric.sdk.android.Fabric.with(Fabric.java:313) at com.mobile.myapp.UI.base.BaseApplication.setupExceptionHandling(BaseApplication.java:51) at com.mobile.myapp.UI.myappApplication.onCreate(myappApplication.java:45) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707) 

And this is how I initialize crashlytics in my Application subclass:

 Fabric.with(this, new Crashlytics()); 

what I'm trying to do is control whether the starchies can work or not. let's say I want flavor1 not to run crashlytics, I thought I could use this gradle flag and set it to false. Did I miss something?

+22
source share
7 answers

Todd Burner Addition

Be careful with BuildConfig.DEBUG . IDE can automatically import it from

 com.crashlytics.android.BuildConfig (= false) 

instead of configuring your application

 ${app_package}.BuildConfig 

UPDATE

Providing an example on j2emanue request

  ... import com.fiot.ot.BuildConfig <- should be import com.crashlytics.android.BuildConfig <- my IDE automatically imported fun initFabric(context: Context) { val core = CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build() val kit = Crashlytics.Builder().core(core).build() Fabric.with(context, kit) } 

Where com.fiot.ot my application package name

+21
source

Maybe not enough to apply plug fabric

I added this line on top of the app/build.gradle to solve my problems!

apply plugin: 'io.fabric'

+53
source

Whenever I install

 ext.enableCrashlytics = false 

my application crashes with

 io.fabric.sdk.android.services.concurrency.UnmetDependencyException This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, install an Android build tool and ask a team member to invite you to this app organization. 

It seems to me that I need to disable Crashlytics auto-initialization by adding this line to AndroidManifest.xml

 <meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" /> 

Then I manually initialize Crashlytics in the onCreate () method of my Application subclass, use BuildConfig.DEBUG to decide whether to disable CrashlyticsCore and call Fabric.with (). In fact, I did not install anymore

 ext.enableCrashlytics = false 

. It all seems to work for me.

+30
source

Todd from fabric. You will get this error if you also do not disable Fabric at run time.

  // Set up Crashlytics, disabled for debug builds Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); // Initialize Fabric with the debug-disabled crashlytics. Fabric.with(this, crashlyticsKit); 

Check this link for more information: https://docs.fabric.io/android/crashlytics/build-tools.html#disable-crashlytics-for-debug-builds

+7
source

For Android Xamarin

You must have the following in order not to get the above error:

  1. Enable NuGet Packages:
    • Xamarin.Android.Crashlytics [from Microsoft]
    • Xamarin.Android.Crashlytics.Core [from Microsoft]
    • Xamarin.Android.Crashlytics.Beta [from Microsoft]
    • Xamarin.Android.Crashlytics.Answers [from Microsoft]
  2. Add this line to your AndroidManifest.xml file in <application> :

    <meta-data android:name="io.fabric.ApiKey" android:value="<FABRIC_API_KEY>"/>

  3. Add this line to the Resources/values/Strings.xml file:

    <string name="com.crashlytics.android.build_id">15</string>

  4. Add this line to MainApplication.cs or YourActivity.cs in OnCreate() :

    Fabric.Fabric.With(this, new Crashlytics.Crashlytics());

Your application should build and run after the initialization line without any problems. The only problem I am facing is that there is another place where you need to update the Build version of your application with every release.


EDIT:

As I understand it, one value is required, but not used at all. In fact, you do not need to increase the assembly number in Strings.xml , it automatically selects the assembly number from the application, so you just need to leave the value at the address: <string name="com.crashlytics.android.build_id">1</string>

If you experience differently for Xamarin, please comment below.

+4
source

Make sure you add in

app.gradle

 apply plugin: 'io.fabric' 

I also have a

 classpath 'io.fabric.tools:gradle:1.26.1' 

in

Project dependencies

and add the Crashlytics API to the lines, register on the Crashlytics website

+3
source

In my case, it worked.

So this is the top level project build.gradle

 buildscript { repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'java' allprojects { repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } } 

and this is build.gradle for the application module

 apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "your application package name" minSdkVersion 10 targetSdkVersion 22 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.google.code.gson:gson:2.3' compile 'com.android.support:support-v4:22.0.0' testCompile 'junit:junit:4.12' testCompile "org.mockito:mockito-core:1.9.5" compile('com.crashlytics.sdk.android:crashlytics: 2.5.2@aar ') { transitive = true; } } 

and finally "clean build" and everything was installed for me.

0
source

Source: https://habr.com/ru/post/1271150/


All Articles