From ae125a5311ac468b2af6a6082b05fe9a4058e188 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Tue, 21 Aug 2018 09:21:20 -0500 Subject: [PATCH] Implement ACRA reporting --- IAP5Helper/build.gradle | 2 +- app/build.gradle | 8 ++++++- .../simplemarkdown/MarkdownApplication.java | 24 +++++++++++++++++++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/IAP5Helper/build.gradle b/IAP5Helper/build.gradle index 99645d8..07c7c88 100644 --- a/IAP5Helper/build.gradle +++ b/IAP5Helper/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion '26.0.2' + buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 14 diff --git a/app/build.gradle b/app/build.gradle index b703d53..ee84c81 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ android { exclude 'META-INF/DEPENDENCIES' } compileSdkVersion 27 - buildToolsVersion "26.0.2" + buildToolsVersion '27.0.3' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -24,6 +24,9 @@ android { versionCode 9 versionName "0.4.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + buildConfigField "String", "ACRA_URL", "\"$acraUrl\"" // Defined in ~/.gradle/gradle.properties + buildConfigField "String", "ACRA_USER", "\"$acraUser\"" // Defined in ~/.gradle/gradle.properties + buildConfigField "String", "ACRA_PASS", "\"$acraPass\"" // Defined in ~/.gradle/gradle.properties } buildTypes { release { @@ -50,6 +53,7 @@ android { } ext { + acraVersion = '5.1.3' support_version = "27.1.0" } @@ -83,5 +87,7 @@ dependencies { implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' implementation 'io.reactivex.rxjava2:rxjava:2.1.0' + implementation "ch.acra:acra-http:$acraVersion" + samsungImplementation project(":IAP5Helper") } diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownApplication.java b/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownApplication.java index 2cac106..0595fdd 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownApplication.java +++ b/app/src/main/java/com/wbrawner/simplemarkdown/MarkdownApplication.java @@ -1,7 +1,23 @@ package com.wbrawner.simplemarkdown; import android.app.Application; +import android.content.Context; +import org.acra.ACRA; +import org.acra.annotation.AcraCore; +import org.acra.annotation.AcraHttpSender; +import org.acra.data.StringFormat; +import org.acra.sender.HttpSender; + +import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_PASS; +import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_URL; +import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_USER; + +@AcraCore(buildConfigClass = BuildConfig.class, reportFormat = StringFormat.JSON) +@AcraHttpSender(uri = ACRA_URL, + basicAuthLogin = ACRA_USER, + basicAuthPassword = ACRA_PASS, + httpMethod = HttpSender.Method.POST) public class MarkdownApplication extends Application { private AppComponent component; @@ -17,4 +33,12 @@ public class MarkdownApplication extends Application { public AppComponent getComponent() { return component; } + + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + + // The following line triggers the initialization of ACRA + ACRA.init(this); + } } diff --git a/build.gradle b/build.gradle index 1183da1..19f6500 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e5ec04c..78a9504 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Nov 28 19:16:56 CST 2017 +#Mon Aug 20 19:40:47 CDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip