Crashlytics error - This app relies on Crashlytics. Please sign up for access

主宰稳场 提交于 2019-12-01 02:04:22

Addition to answer of Todd Burner

Be carefull with BuildConfig.DEBUG. IDE can auto-import it from

com.crashlytics.android.BuildConfig (= false)

instead of your app config

${app_package}.BuildConfig

UPDATE

Providing an example on the request of j2emanue

    ...
    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 package name of my app

Maybe missing apply plugin fabric

I added this line on top of file app/build.gradle resolved my issues!

apply plugin: 'io.fabric'

Whenever I set

ext.enableCrashlytics = false

my app 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's organization.

What seems to work for me is that I have to disable automatic initialization of Crashlytics 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 no longer set

ext.enableCrashlytics = false

at all. It all seems to work to me.

Todd from Fabric. You will get this error unless you also 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 out this link for more details: https://docs.fabric.io/android/crashlytics/build-tools.html#disable-crashlytics-for-debug-builds

Make sure you add in

app.gradle

apply plugin: 'io.fabric'

I also have

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

in the

project gradle dependencies

and add the Crashlytics api in the strings, signup in the Crashlytics Site

For Xamarin Android

You need to have the following not to receive the above error:

  1. Include the NuGet packages:
    • Xamarin.Android.Crashlytics [by Microsoft]
    • Xamarin.Android.Crashlytics.Core [by Microsoft]
    • Xamarin.Android.Crashlytics.Beta [by Microsoft]
    • Xamarin.Android.Crashlytics.Answers [by Microsoft]
  2. Add this line in your AndroidManifest.xml file within <application>:

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

  3. Add this line in Resources/values/Strings.xml resource file:

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

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

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

Your app should build and run past the initialization line without any issues. Only problem I have with it is the fact that there is one more place you need to update the Build version of your app everytime your release.


EDIT :

As far as I'm experiencing, the one value is required but not used at all. You do not actually have to increase the build number in Strings.xml, it picks up the build number from the app automatically, so you should be fine just to leave the value at: <string name="com.crashlytics.android.build_id">1</string>

If you experience it differently for Xamarin, please comment below.

In My case this got 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 the build.gradle for app 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 at last "clean build" and all was set for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!