Fabric / Crashlytics:gradle需要运行两次

时间:2015-12-03 01:31:55

标签: android-gradle twitter-fabric crashlytics-android

我正在开发一个应用程序,当在命令行中使用gradle构建它(“clean build”甚至“clean installRelease”)时,我面临着Crashlytics无法启动的问题:

java.lang.RuntimeException: Unable to create application XXXXXXXX: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: com.crashlytics.android.core.CrashlyticsMissingDependencyException: 
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.

在尝试了很多东西后,我发现如果我跑了:

./gradlew clean installRelease
./gradlew installRelease

我的应用程序启动没有任何问题。

这有点痛苦,因为我必须在发布之前构建应用程序两次(如果我忘记这样做,我发布一个无法使用的应用程序:/

我的gradle文件设置正确(至少,插件没有抱怨),gradle是最新的(gradle 2.9,android插件1.5.0,crashlytics 2.5.4,...)

以下是我的build.gradle中的几行:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.20.1'
        classpath 'me.tatarka:gradle-retrolambda:3.2.3'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'io.fabric'


android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    signingConfigs {
        std {
        }
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "XXXXXXXXXXX"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.std
        }
        debug {
            signingConfig signingConfigs.std
        }
    }

    productFlavors {
        stubbed {
            buildConfigField "boolean", "STUBBED", "true"
        }
        real {
            buildConfigField "boolean", "STUBBED", "false"
        }
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    dataBinding {
        enabled = true
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.4@aar') {
        transitive = true;
    }
    compile 'com.google.android.gms:play-services-gcm:8.3.0'

    compile 'com.jakewharton:butterknife:7.0.1'
}

如果有人曾经面对并解决过这类问题,我很想听听:) 谢谢!

0 个答案:

没有答案