没有这样的 属性: betaDistributionApkFilePath while building with crashlytics

No such property: betaDistributionApkFilePath while building with crashlytics

今天我更新了很久没有更新的最新版本的crashlytics

我在构建文件时遇到以下错误。

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

我没有在我的 gradle 文件中设置任何 betaDistributionApkFilePath 属性。

这是在我按照织物网站上给出的说明将其更新到最新版本后发生的。我尝试将其降级为旧版本,但无济于事。我也,试图找出更多关于错误的信息,但似乎我是第一个面对这个问题的人。

我的项目级别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
}

这是我的应用级别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'

您的应用级别 build.gradle 中的以下几行是导致问题的原因。

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"
}

在项目级别 build.gradle

的 buildScript{} 中声明它
buildscript {

ext {
    crashlytics = '2.9.0'
   }
 } 

为了在应用级别 build.gradle 中访问这些变量,请像这样使用

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

希望这对您有所帮助...