androidcrashlyticscrashlytics-androidcrashlytics-beta

No such property: betaDistributionApkFilePath for class: java.lang.String


I have found little glitch in crashlytics/fabric setup in gradle which took 2 hours of my poor life.

first of all i did everything they said in this guide: https://fabric.io/kits/android/crashlytics/install

and here is the piece of code which everything caused:

First try

dependencies {
      ...

      compile('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
        transitive = true;
      }
}

every library version in dependencies{} block iam using ext{} block in appname/app/build.gradle so in our case

ext {
    crashlytics = '2.9.4@aar'
}

so in the end it will be like this only change implementation which should be there in my opinion because it will be deprecated at end of 2018. implementations doenst change any behavior.

implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics"){
    transitive = true
}

but if u try to build this u gonna get:

No such property: betaDistributionApkFilePath for class: java.lang.String

wow. i have no idea why.. but lets investigate this. we will try different setup so forget everyting you saw above.

Second try

in our appname/app/build.gradle in dependencies{} change our lane to this so we have no ext{} for version

implementation("com.crashlytics.sdk.android:crashlytics:$rootProject.ext.crashlytics") {
    transitive = true
}

and now in our root gradle appname/build.gradle

buildscript {
    ext.fabric_gradle = '2.9.4@aar'

    repositories {
      ...
    }
    dependencies {
      ...
    }
}

Build is OK you can continue to work. But what? Its should be completely the same...

Third try

I dont know why but in our first try u just CANT in appname/app/build.gradle ext{} block name crashlytics variable it have to very everything else except crashlytics for instance crashlytics_version so lets make first try to working state.

ext {
    crashlytics_version = '2.9.4@aar'
}

implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics_version"){
    transitive = true
}

Build is OK. Magic.

or just do it in normal way and dont try to make smart things.... As first block of code in this long investigation which works also completely fine:

compile('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
  transitive = true;
}

Solution

  • You just CANT in appname/app/build.gradle ext{} block name your variable crashlytics it have to be everything else except crashlytics for instance crashlytics_version so:

    ext {
        crashlytics_version = '2.9.4@aar'
    }
    
    implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics_version"){
        transitive = true
    }
    

    Build is OK.

    or just do it in normal way:

    compile('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
      transitive = true;
    }