Migrate from fabric to firebase for crashlytics (#142)

* Migrate from fabric to firebase for crashlytics

* Disable firebase crashlytics for purefoss flavour

* Exclude all non-prod flavours

* Target 29 to prevent cache data open failure in webview bug
This commit is contained in:
Prem Nirmal
2020-08-14 10:28:59 +01:00
committed by GitHub
parent a5e9f448b8
commit d96b9825ad
12 changed files with 58 additions and 90 deletions
-12
View File
@@ -16,17 +16,5 @@ app/prod/
keystore.*
app/keystore.*
#crashlytics secret
fabric.properties
crashlytics.properties
app/src/prod/AndroidManifest.xml
app/src/main/assets/crashlytics-build.properties
app/src/main/res/values/com_crashlytics_export_strings.xml
#google services
app/google-services.json
app/src/dev/google-services.json
app/src/prod/google-services.json
#google translate secret
app/translate.properties
-1
View File
@@ -18,7 +18,6 @@ The app does use third party services that may collect information used to ident
Link to privacy policy of third party service providers used by the app
* [Google Play Services](https://www.google.com/policies/privacy/)
* [Fabric](https://fabric.io/privacy)
**Log Data**
+1
View File
@@ -15,6 +15,7 @@
- A homescreen widget that shows your stock portolio in a resizable grid.
- Stocks can be sorted by dragging and dropping the list.
- Only performs automatic fetching of stocks during trading hours.
- Displays price change and summary alerts
### Importing and exporting
- You can import a list of tickers by selecting **import tickers** from the settings menu. All you need is a textfile with your tickers in *comma-separated* format, or in *json format*.
+44 -32
View File
@@ -2,7 +2,8 @@ apply from: "../build.gradle"
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "io.fabric"
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
apply plugin: "com.getkeepsafe.dexcount"
apply plugin: "kotlin-kapt"
@@ -10,22 +11,22 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.fabric.io/public" }
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://jitpack.io" }
}
dependencies {
classpath "io.fabric.tools:gradle:1.31.2"
classpath "com.google.gms:google-services:4.3.3"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.2.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2"
classpath('com.github.ayvazj.gradle.plugins.androlate:androlate:0.1')
}
}
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.fabric.io/public" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
@@ -48,7 +49,7 @@ dexcount {
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
buildToolsVersion "29.0.2"
final File versionFile = file("file:version.properties")
final Properties versionProps = new Properties()
@@ -83,7 +84,7 @@ android {
purefoss.java.srcDirs += "src/purefoss/kotlin"
String testDir = "src/test/kotlin"
test {
resources.srcDirs += ['src/test/resources']
resources.srcDirs += ["src/test/resources"]
java.srcDir testDir
}
}
@@ -181,13 +182,13 @@ kapt {
ext {
LIFECYCLE_VERSION = "2.2.0"
DAGGER_VERSION = "2.20"
DAGGER_VERSION = "2.27"
MOCKITO_VERSION = "3.1.0"
JUNIT_VERSION = "4.12"
RETROFIT_VERSION = "2.7.1"
OKHTTP_VERSION = "3.12.10"
OKHTTP_VERSION = "3.14.4"
ROBOLECTRIC_VERSION = "4.3.1"
COROUTINES_VERSION = "1.3.5"
COROUTINES_VERSION = "1.3.7"
ROOM_VERSION = "2.2.5"
WORK_VERSION = "2.4.0"
}
@@ -197,12 +198,12 @@ dependencies {
implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "com.google.android.material:material:1.2.0"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.browser:browser:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "javax.inject:javax.inject:1"
implementation "javax.annotation:javax.annotation-api:1.3.2"
@@ -210,7 +211,7 @@ dependencies {
implementation "com.google.dagger:dagger:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
implementation ("com.squareup.okhttp3:okhttp:$OKHTTP_VERSION")
implementation "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION"
implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION"
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
@@ -226,32 +227,30 @@ dependencies {
implementation "com.jakewharton.threetenabp:threetenabp:1.2.4"
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
implementation "io.github.inflationx:calligraphy3:3.1.1"
implementation "io.github.inflationx:viewpump:2.0.3"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation "com.github.PhilJay:MPAndroidChart:v3.0.3"
implementation "androidx.room:room-runtime:$ROOM_VERSION"
kapt "androidx.room:room-compiler:$ROOM_VERSION"
implementation "androidx.room:room-ktx:$ROOM_VERSION"
debugImplementation 'com.facebook.stetho:stetho:1.5.1'
debugImplementation "com.facebook.stetho:stetho:1.5.1"
prodImplementation("com.crashlytics.sdk.android:crashlytics:2.10.1@aar") {
transitive = true
}
prodImplementation("com.google.firebase:firebase-analytics:17.4.4")
prodImplementation "com.google.firebase:firebase-crashlytics:17.1.1"
prodImplementation "com.google.firebase:firebase-analytics:17.4.4"
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.4"
testImplementation "junit:junit:$JUNIT_VERSION"
testImplementation "org.assertj:assertj-core:3.8.0"
testImplementation "org.robolectric:robolectric:$ROBOLECTRIC_VERSION"
testImplementation "org.robolectric:shadows-multidex:$ROBOLECTRIC_VERSION"
testImplementation 'androidx.test:runner:1.2.0'
testImplementation 'androidx.test:rules:1.2.0'
testImplementation 'androidx.annotation:annotation:1.1.0'
testImplementation "androidx.test:runner:1.2.0"
testImplementation "androidx.test:rules:1.2.0"
testImplementation 'androidx.test:runner:1.2.0'
testImplementation "androidx.annotation:annotation:1.1.0"
testImplementation "androidx.test:rules:1.2.0"
testImplementation "androidx.test:runner:1.2.0"
testImplementation "org.threeten:threetenbp:1.4.4"
testImplementation "org.mockito:mockito-core:$MOCKITO_VERSION"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
@@ -265,7 +264,20 @@ dependencies {
}
configurations.all {
resolutionStrategy.force 'org.objenesis:objenesis:2.5.1'
resolutionStrategy.force "org.objenesis:objenesis:2.5.1"
resolutionStrategy.force "org.ow2.asm:asm:7.0"
exclude group: 'xpp3', module: 'xpp3'
exclude group: "xpp3", module: "xpp3"
}
android.applicationVariants.all { variant ->
if (!variant.name.toLowerCase().contains("prod")) {
def googleTask = tasks.findByName("process${variant.name.capitalize()}GoogleServices")
def crashlyticsMappingTask = tasks.findByName("uploadCrashlyticsMappingFile${variant.name.capitalize()}")
println("flavor: ${variant.name}")
println("disabling ${googleTask.name}")
println("disabling ${crashlyticsMappingTask.name}")
googleTask.enabled = false
crashlyticsMappingTask.enabled = false
}
}
@@ -1,14 +1,8 @@
package com.github.premnirmal.ticker.components
import android.content.Context
import timber.log.Timber
/**
* Created by premnirmal on 2/28/16.
*/
class LoggingTree : Timber.DebugTree {
constructor(context: Context) {
// Do nothing.
}
}
class LoggingTree : Timber.DebugTree()
@@ -76,7 +76,7 @@ open class StocksApp : MultiDexApplication() {
}
protected open fun initLogger() {
Timber.plant(LoggingTree(this))
Timber.plant(LoggingTree())
}
protected open fun initAnalytics() {
@@ -129,7 +129,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
viewModel.newsData.observe(this, Observer { data ->
analytics.trackGeneralEvent(
GeneralEvent("FetchNews")
.addProperty("Instrument", ticker)
.addProperty("Success", "True")
)
setUpArticles(data)
@@ -139,7 +138,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
InAppMessage.showMessage(this@QuoteDetailActivity, R.string.news_fetch_failed, error = true)
analytics.trackGeneralEvent(
GeneralEvent("FetchNews")
.addProperty("Instrument", ticker)
.addProperty("Success", "False")
)
})
@@ -243,7 +241,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
private fun positionOnClickListener() {
analytics.trackClickEvent(
ClickEvent("EditPositionClick")
.addProperty("Instrument", ticker)
)
val intent = Intent(this, AddPositionActivity::class.java)
intent.putExtra(AddPositionActivity.TICKER, quote.symbol)
@@ -253,7 +250,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
private fun notesOnClickListener() {
analytics.trackClickEvent(
ClickEvent("EditNotesClick")
.addProperty("Instrument", ticker)
)
val intent = Intent(this, AddNotesActivity::class.java)
intent.putExtra(AddNotesActivity.TICKER, quote.symbol)
@@ -263,7 +259,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
private fun alertsOnClickListener() {
analytics.trackClickEvent(
ClickEvent("EditAlertsClick")
.addProperty("Instrument", ticker)
)
val intent = Intent(this, AddAlertsActivity::class.java)
intent.putExtra(AddAlertsActivity.TICKER, quote.symbol)
@@ -432,7 +427,6 @@ class QuoteDetailActivity : BaseGraphActivity(), NewsFeedAdapter.NewsClickListen
fun openGraph(v: View) {
analytics.trackClickEvent(
ClickEvent("GraphClick")
.addProperty("Instrument", ticker)
)
val intent = Intent(this, GraphActivity::class.java)
intent.putExtra(GraphActivity.TICKER, ticker)
@@ -93,8 +93,7 @@ class PortfolioFragment : BaseFragment(), QuoteClickListener, OnStartDragListene
quote: Quote,
position: Int
) {
analytics.trackClickEvent(ClickEvent("InstrumentClick")
.addProperty("Instrument", quote.symbol))
analytics.trackClickEvent(ClickEvent("InstrumentClick"))
val intent = Intent(view.context, QuoteDetailActivity::class.java)
intent.putExtra(QuoteDetailActivity.TICKER, quote.symbol)
startActivity(intent)
@@ -1,28 +1,17 @@
package com.github.premnirmal.ticker.components
import android.content.Context
import android.util.Log
import com.crashlytics.android.Crashlytics
import com.crashlytics.android.answers.Answers
import com.crashlytics.android.core.CrashlyticsCore
import com.github.premnirmal.tickerwidget.BuildConfig
import io.fabric.sdk.android.Fabric
import com.google.firebase.crashlytics.FirebaseCrashlytics
import timber.log.Timber
/**
* Created by premnirmal on 2/28/16.
*/
class LoggingTree(context: Context) : Timber.Tree() {
class LoggingTree : Timber.Tree() {
init {
val kit = Crashlytics.Builder()
.core(
CrashlyticsCore.Builder()
.disabled(BuildConfig.DEBUG)
.build()
)
.build()
Fabric.with(context, kit, Answers())
private val crashlytics: FirebaseCrashlytics = FirebaseCrashlytics.getInstance().apply {
setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
}
override fun log(
@@ -34,11 +23,9 @@ class LoggingTree(context: Context) : Timber.Tree() {
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return
}
if (message != null) {
Crashlytics.log(message)
}
crashlytics.log(message)
if (t != null) {
Crashlytics.logException(t)
crashlytics.recordException(t)
}
}
}
@@ -1,14 +1,8 @@
package com.github.premnirmal.ticker.components
import android.content.Context
import timber.log.Timber
/**
* Created by premnirmal on 2/28/16.
*/
internal class LoggingTree : Timber.DebugTree {
constructor(context: Context) {
// Do nothing.
}
}
internal class LoggingTree : Timber.DebugTree()
+2 -2
View File
@@ -1,2 +1,2 @@
versionName=3.9.709
versionCode=300900709
versionName=3.9.711
versionCode=300900711
+1 -1
View File
@@ -8,7 +8,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}