Search code examples
androidandroid-gradle-plugincrashlyticsgoogle-fabric

No such property: betaDistributionApkFilePath while building with crashlytics


Today I updated to the latest version of crashlytics which was not updated from a very long time.

I am getting the below error while building the file.

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

I am not setting any betaDistributionApkFilePath property in my gradle file.

This happened after I updated it to the latest version by following the instructions given on the fabric's website. I tried down grading it to a bit older version, but no help. I also, tried to found out more about the error, but it seems that I am the first to face this.

my project level build.gradle

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    all*.exclude group: 'com.google.android.gms', module: 'play-services'
}

buildscript {

    ext {
        // root project
        androidGradleVersion = "3.0.1"
        googleServices = "3.2.0"
        crashlytics = "1.25.1"
    }

    repositories {
        jcenter()
        mavenCentral()
        google()

        maven {
            url 'https://maven.fabric.io/public'
        }
    }

    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "com.android.tools.build:gradle:$androidGradleVersion"
        classpath "com.google.gms:google-services:$googleServices"
        classpath "io.fabric.tools:gradle:$crashlytics"
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}


task clean(type: Delete) {
    delete rootProject.buildDir
}

And this is my App level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

ext {

    // android
    playService = "11.4.2"
    supportLibrary = "27.0.2"
    constrainLayout = "1.0.2"

    // libraries
    retofit = "1.9.0"
    okHttp = "2.0.0"
    eventBus = "1.3.8"
    picasso = "2.5.2"
    calligraphy = "2.3.0"
    socketIo = "0.3.0"
    facebook = "4.30.0"
    circularReveal = "1.3.1"
    imageCropper = "1.2.2"
    expandableRecyclerView = "2.1.1"
    crashlytics = "2.9.0"
    selectableBackgroudImageView = "1.0.1"
    multidex = "1.0.1"
}

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "myappid"
        minSdkVersion 16
        targetSdkVersion 21

        versionCode 01
        versionName "01"
        multiDexEnabled true
    }

    buildTypes {
        debug {
            resValue "string", "app_name", "MyApp Dev"
            applicationIdSuffix ".debug"
        }

        release {
            resValue "string", "app_name", "MyApp"
            zipAlignEnabled true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {
        javaMaxHeapSize "6g"
    }

    sourceSets {
        main {
            res.srcDirs = ['src/main/res', 'src/main/res/anim-v21']
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

repositories {
    mavenCentral()

    maven {
        url "https://jitpack.io"
    }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {

    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    implementation "com.google.firebase:firebase-database:$playService"
    implementation "com.google.firebase:firebase-auth:$playService"
    implementation "com.google.firebase:firebase-core:$playService"
    implementation "com.google.firebase:firebase-messaging:$playService"
    implementation "com.google.android.gms:play-services-cast:$playService"
    implementation "com.google.android.gms:play-services-gcm:$playService"
    implementation "com.google.android.gms:play-services-analytics:$playService"
    implementation "com.google.android.gms:play-services-maps:$playService"
    implementation "com.google.android.gms:play-services-location:$playService"
    implementation "com.google.android.gms:play-services-auth:$playService"

    implementation "com.squareup.retrofit:retrofit:$retofit"
    implementation "com.squareup.okhttp:okhttp-urlconnection:$okHttp"
    implementation "com.squareup.okhttp:okhttp:$okHttp"
    implementation "com.squareup:otto:$eventBus"
    implementation "com.squareup.picasso:picasso:$picasso"

    implementation "com.android.support:support-v4:$supportLibrary"
    implementation "com.android.support:recyclerview-v7:$supportLibrary"
    implementation "com.android.support:design:$supportLibrary"
    implementation "com.android.support:appcompat-v7:$supportLibrary"
    implementation "com.android.support:cardview-v7:$supportLibrary"
    implementation "com.android.support:mediarouter-v7:$supportLibrary"
    implementation "com.android.support.constraint:constraint-layout:$constrainLayout"

    implementation "uk.co.chrisjenx:calligraphy:$calligraphy"
    implementation "com.github.nkzawa:socket.io-client:$socketIo"
    implementation "com.facebook.android:facebook-android-sdk:$facebook"
    implementation "com.facebook.android:facebook-login:$facebook"
    implementation "com.github.ozodrukh:CircularReveal:$circularReveal"
    implementation "com.theartofdev.edmodo:android-image-cropper:$imageCropper"
    implementation "com.bignerdranch.android:expandablerecyclerview:$expandableRecyclerView"
    implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics@aar") {
        transitive = true
    }

    implementation "com.joooonho:selectableroundedimageview:$selectableBackgroudImageView"
    implementation "com.android.support:multidex:$multidex"
}

apply plugin: 'com.google.gms.google-services'

Solution

  • Below lines in your app level build.gradle is causing the issue.

    ext {
    
    // android
    playService = "11.4.2"
    supportLibrary = "27.0.2"
    constrainLayout = "1.0.2"
    
    // libraries
    retofit = "1.9.0"
    okHttp = "2.0.0"
    eventBus = "1.3.8"
    picasso = "2.5.2"
    calligraphy = "2.3.0"
    socketIo = "0.3.0"
    facebook = "4.30.0"
    circularReveal = "1.3.1"
    imageCropper = "1.2.2"
    expandableRecyclerView = "2.1.1"
    crashlytics = "2.9.0"
    selectableBackgroudImageView = "1.0.1"
    multidex = "1.0.1"
    }
    

    Declare it inside buildScript{} in project level build.gradle

    buildscript {
    
    ext {
        crashlytics = '2.9.0'
       }
     } 
    

    And for accessing these variables inside app level build.gradle, use like this

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

    Hope this helps...