Switch to Firebase for Crashlytics

This commit is contained in:
Aidan Follestad 2019-03-14 13:55:19 -07:00
parent 6d382b93a5
commit 334e9e823c
11 changed files with 87 additions and 55 deletions

4
.gitignore vendored
View file

@ -180,4 +180,6 @@ gradle-app.setting
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# gradle/wrapper/gradle-wrapper.properties
app/google-services.json

2
.idea/misc.xml generated
View file

@ -40,7 +40,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -4,8 +4,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply from: '../fabric.gradle'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
@ -18,14 +16,9 @@ android {
versionName versions.publishVersion
}
buildTypes {
debug {
ext.enableCrashlytics = false
buildConfigField "String", "FABRIC_API_KEY", "\"\""
}
release {
buildConfigField "String", "FABRIC_API_KEY", "\"${getFabricApiKey()}\""
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
@ -41,6 +34,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:' + versions.androidxRecyclerView
implementation 'com.google.android.material:material:' + versions.googleMaterial
implementation 'androidx.browser:browser:' + versions.androidxBrowser
implementation 'com.google.firebase:firebase-core:' + versions.firebaseCore
// Lifecycle
kapt 'androidx.lifecycle:lifecycle-compiler:' + versions.lifecycle
@ -74,4 +68,8 @@ dependencies {
androidTestImplementation 'androidx.test:rules:' + versions.androidxTestRunner
}
apply from: '../spotless.gradle'
apply from: '../spotless.gradle'
apply from: '../mock/mock.gradle'
apply plugin: "io.fabric"
apply plugin: 'com.google.gms.google-services'

View file

@ -47,10 +47,8 @@ class NockNockApp : Application() {
Timber.plant(DebugTree())
}
if (BuildConfig.FABRIC_API_KEY.isNotEmpty()) {
Timber.plant(FabricTree())
Fabric.with(this, Crashlytics())
}
Timber.plant(FabricTree())
Fabric.with(this, Crashlytics())
val modules = listOf(
prefModule,

View file

@ -15,6 +15,7 @@ buildscript {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + versions.kotlin
classpath 'com.github.ben-manes:gradle-versions-plugin:' + versions.versionPlugin
classpath 'io.fabric.tools:gradle:' + versions.fabricPlugin
classpath 'com.google.gms:google-services:' + versions.googleServices
}
}

View file

@ -30,6 +30,7 @@ dependencies {
implementation 'org.mozilla:rhino:' + versions.rhino
api 'com.afollestad:rxkprefs:' + versions.rxkPrefs
api "io.reactivex.rxjava2:rxjava:" + versions.rxJava
testImplementation 'junit:junit:' + versions.junit
testImplementation 'com.google.truth:truth:' + versions.truth

View file

@ -7,13 +7,14 @@ ext.versions = [
publishVersionCode : 42,
// Plugins
gradlePlugin : '3.3.1',
spotlessPlugin : '3.18.0',
versionPlugin : '0.20.0',
gradlePlugin : '3.3.2',
spotlessPlugin : '3.19.0',
versionPlugin : '0.21.0',
googleServices : '4.2.0',
fabricPlugin : '1.+',
// Misc
okHttp : '3.13.1',
okHttp : '3.14.0',
rhino : '1.7.10',
// Kotlin
@ -22,20 +23,22 @@ ext.versions = [
koin : '1.0.2',
// Google/AndroidX
androidxAnnotations : '1.0.1',
androidxAnnotations : '1.0.2',
androidxCore : '1.0.2',
androidxRecyclerView: '1.0.0',
androidxBrowser : '1.0.0',
googleMaterial : '1.0.0',
room : '2.0.0',
lifecycle : '2.0.0',
firebaseCore : '16.0.7',
// Rx
rxJava : '2.2.7',
rxBinding : '3.0.0-alpha1',
// afollestad
materialDialogs : '2.0.0',
rxkPrefs : '1.2.4',
materialDialogs : '2.0.3',
rxkPrefs : '1.2.5',
vvalidator : '0.3.1',
// Debugging
@ -44,9 +47,9 @@ ext.versions = [
// Unit testing
junit : '4.12',
mockito : '2.24.5',
mockito : '2.25.0',
mockitoKotlin : '2.1.0',
truth : '0.42',
truth : '0.43',
// UI testing
androidxTestRunner : '1.1.1',

View file

@ -1,29 +0,0 @@
apply plugin: 'io.fabric'
ext.getFabricApiKey = {
return System.getenv('FABRIC_APIKEY') ?: "xxxe76c4xxxx97e8cxxxx0135e9d46f5a2xxx"
}
ext.getFabricApiSecret = {
return System.getenv('FABRIC_APISECRET') ?: "xx68f6074dxxxxxc11dxxx97c172e8ebf0"
}
def buildFabricProperties() {
def propertiesFile = file("fabric.properties")
def apiSecret = getFabricApiSecret()
def apiKey = getFabricApiKey()
if (propertiesFile.exists()) {
propertiesFile.delete()
}
def commentMessage = "suppress inspection \"UnusedProperty\" for whole file"
ant.propertyfile(file: "fabric.properties", comment: commentMessage) {
entry(key: "apiSecret", value: apiSecret)
entry(key: "apiKey", value: apiKey)
}
}
afterEvaluate {
buildFabricProperties()
}

View file

@ -16,3 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true

View file

@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "123456789000",
"firebase_url": "https://mockproject-1234.firebaseio.com",
"project_id": "mockproject-1234",
"storage_bucket": "mockproject-1234.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063",
"android_client_info": {
"package_name": "com.afollestad.nocknock"
}
},
"oauth_client": [
{
"client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

13
mock/mock.gradle Normal file
View file

@ -0,0 +1,13 @@
// This script must be applied in app/build.gradle for the paths here to work correctly
def copyMockFilesNeeded() {
def srcGoogleServicesFile = file("../mock/mock-google-services.json")
def destGoogleServicesFile = file("google-services.json")
if (!destGoogleServicesFile.exists()) {
destGoogleServicesFile.write(srcGoogleServicesFile.text)
}
}
afterEvaluate {
copyMockFilesNeeded()
}