Automatic Beta Releases with crashlytics

只谈情不闲聊 提交于 2019-12-18 18:09:00

问题


My android application has a Library which includes 'crashlytics.start()'. I have only set Crashlytics.jar as a dependency for the Library project. Builds are successful.

I have multiple flavors configured in app> build.gradle file as well.

Given that one of my builds flavors are called "production", I have the following configuration in my app> build.gradle file

   buildscript {
    repositories {
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.13+'

    }
}

apply plugin: 'android'


repositories {
    mavenCentral()

}


android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.test.testapp"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "0.0.6"
    }
    buildTypes {
        release {
            ext.enableCrashlytics=true
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ext.betaDistributionEmails="email" 
            ext.betaDistributionReleaseNotes='Testing automatic release.Ignore this version'

        }

        debug{
            ext.enableCrashlytics=true
            runProguard false

        }
    }

    productFlavors {
        production {
            applicationId "com.test.testapp"
        }

        staging {
            applicationId "com.test.testapp.staging"
        }

        preprod {
            applicationId "ccom.test.testapp.preprod"
        }

    }
}

dependencies {
    compile 'com.android.support:support-v4:18.+'
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile project(':lib1')
    compile project(':lib2')

}

I use following command to upload the built 'production 'flavor to crashlytics

assembleproductionRelease crashlyticsUploadDistributionproductionRelease

However I get the following error

Task 'crashlyticsUploadDistributionproductionRelease' not found in root project 

This looks similar to this question however the solution is not working for me. There for posting with details.

NOTE: I have added a local crashlytics.jar when including crashlytics dependency. Since including the hosted crashlytics dependency had issues when compiling the project.


回答1:


I have working configuration in my environment, so will just share gradle.build pieces that are different: 1. Buildscript

buildscript {
    repositories {
        jcenter()
        maven { url 'http://download.crashlytics.com/maven' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
    } 
}
  1. Don't forget to apply plugin

apply plugin: 'crashlytics'

  1. Repositories
repositories {
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
    }

Hope this will help



来源:https://stackoverflow.com/questions/27519482/automatic-beta-releases-with-crashlytics

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