Add ACRA crash reporting
This commit is contained in:
parent
606c3f17e9
commit
174364131a
4 changed files with 32 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@
|
|||
*.log
|
||||
.idea/
|
||||
*~
|
||||
acra.properties
|
|
@ -7,8 +7,15 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
|
||||
Properties acra = new Properties()
|
||||
acra.load(new FileInputStream("app/acra.properties"))
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "com.wbrawner.myallowance"
|
||||
minSdkVersion 23
|
||||
|
@ -19,6 +26,9 @@ android {
|
|||
useSupportLibrary = true
|
||||
}
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
buildConfigField "String", "ACRA_URL", "\"${acra.getProperty("url")}\""
|
||||
buildConfigField "String", "ACRA_USER", "\"${acra.getProperty("user")}\""
|
||||
buildConfigField "String", "ACRA_PASS", "\"${acra.getProperty("pass")}\""
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -43,6 +53,10 @@ dependencies {
|
|||
kapt "android.arch.persistence.room:compiler:$room_version"
|
||||
testImplementation "android.arch.persistence.room:testing:$room_version"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
// ACRA Crash reporting
|
||||
def acraVersion = '5.1.3'
|
||||
implementation "ch.acra:acra-http:$acraVersion"
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
}
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package com.wbrawner.myallowance
|
||||
|
||||
import android.app.Application
|
||||
import android.arch.lifecycle.ViewModelProvider
|
||||
import android.arch.persistence.room.Room
|
||||
import android.arch.persistence.room.Transaction
|
||||
import android.content.Context
|
||||
import com.wbrawner.myallowance.data.TransactionDao
|
||||
import com.wbrawner.myallowance.data.TransactionsDatabase
|
||||
import org.acra.ACRA
|
||||
import org.acra.annotation.AcraCore
|
||||
import org.acra.annotation.AcraHttpSender
|
||||
import org.acra.data.StringFormat
|
||||
import org.acra.sender.HttpSender
|
||||
|
||||
@AcraCore(reportFormat = StringFormat.JSON)
|
||||
@AcraHttpSender(uri = BuildConfig.ACRA_URL,
|
||||
basicAuthLogin = BuildConfig.ACRA_USER,
|
||||
basicAuthPassword = BuildConfig.ACRA_PASS,
|
||||
httpMethod = HttpSender.Method.POST)
|
||||
class AllowanceApplication: Application() {
|
||||
lateinit var database: TransactionsDatabase
|
||||
private set
|
||||
|
@ -20,6 +29,11 @@ class AllowanceApplication: Application() {
|
|||
database = Room.databaseBuilder(applicationContext, TransactionsDatabase::class.java, "transactions")
|
||||
.build()
|
||||
dao = database.dao()
|
||||
}
|
||||
|
||||
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
super.attachBaseContext(base)
|
||||
ACRA.init(this)
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
Loading…
Reference in a new issue