diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba6f292..3dec0c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,9 +45,9 @@ jobs: SIGNING_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - ACRA_URI: ${{ secrets.ACRA_URI }} - ACRA_LOGIN: ${{ secrets.ACRA_LOGIN }} - ACRA_PASSWORD: ${{ secrets.ACRA_PASSWORD }} + GOOGLE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }} + GOOGLE_APP_ID: ${{ secrets.GOOGLE_APP_ID }} + GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} run: | base64 --decode <<< "$SIGNING_KEYSTORE_BASE64" > app/release.keystore ./gradlew assembleRelease bundleRelease diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d1e7627..220b692 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -55,9 +55,10 @@ android { } create("play") { dimension = "store" - listOf("ACRA_URI", "ACRA_LOGIN", "ACRA_PASSWORD").forEach { key -> - buildConfigField("String", key, System.getenv(key)?.let { "\"$it\"" } ?: "null") - } + resValue("string", "project_id", System.getenv("GOOGLE_PROJECT_ID") ?: "") + resValue("string", "google_app_id", System.getenv("GOOGLE_APP_ID") ?: "") + resValue("string", "google_api_key", System.getenv("GOOGLE_API_KEY") ?: "") + resValue("string", "com.crashlytics.android.build_id", "1") } } compileOptions { @@ -102,7 +103,7 @@ dependencies { implementation("app.cash.sqldelight:coroutines-extensions:2.0.1") // crash reporting - add("playImplementation", "ch.acra:acra-http:5.11.3") + add("playImplementation", "com.google.firebase:firebase-crashlytics:18.6.1") } @@ -128,9 +129,9 @@ androidComponents { add("SIGNING_KEY_PASSWORD") } if (variant.flavorName == "play") { - add("ACRA_URI") - add("ACRA_LOGIN") - add("ACRA_PASSWORD") + add("GOOGLE_PROJECT_ID") + add("GOOGLE_APP_ID") + add("GOOGLE_API_KEY") } }.forEach { key -> if (System.getenv(key).isNullOrEmpty()) { diff --git a/app/lint.xml b/app/lint.xml new file mode 100644 index 0000000..9af5e51 --- /dev/null +++ b/app/lint.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/proguard.pro b/app/proguard.pro index 2b7c8b9..e84424c 100644 --- a/app/proguard.pro +++ b/app/proguard.pro @@ -1,2 +1 @@ -dontwarn javax.annotation.processing.* --keep class org.acra.** { *; } diff --git a/app/src/main/java/org/sirekanyan/outline/App.kt b/app/src/main/java/org/sirekanyan/outline/App.kt index 633ad05..408afb4 100644 --- a/app/src/main/java/org/sirekanyan/outline/App.kt +++ b/app/src/main/java/org/sirekanyan/outline/App.kt @@ -36,8 +36,8 @@ class App : Application() { val debugDao: DebugDao by lazy { DebugDaoImpl(database) } val res: Res by lazy { ResImpl(this) } - override fun attachBaseContext(base: Context?) { - super.attachBaseContext(base) + override fun onCreate() { + super.onCreate() CrashReporter.init(this) } diff --git a/app/src/play/kotlin/org/sirekanyan/outline/CrashReporter.kt b/app/src/play/kotlin/org/sirekanyan/outline/CrashReporter.kt index 01a4d89..5d0a647 100644 --- a/app/src/play/kotlin/org/sirekanyan/outline/CrashReporter.kt +++ b/app/src/play/kotlin/org/sirekanyan/outline/CrashReporter.kt @@ -1,29 +1,17 @@ package org.sirekanyan.outline -import org.acra.ACRA -import org.acra.config.CoreConfigurationBuilder -import org.acra.config.HttpSenderConfigurationBuilder -import org.acra.sender.HttpSender +import com.google.firebase.Firebase +import com.google.firebase.crashlytics.crashlytics +import com.google.firebase.initialize object CrashReporter { fun init(app: App) { - val httpSenderConfig = HttpSenderConfigurationBuilder() - .withUri(BuildConfig.ACRA_URI) - .withHttpMethod(HttpSender.Method.POST) - .withBasicAuthLogin(BuildConfig.ACRA_LOGIN) - .withBasicAuthPassword(BuildConfig.ACRA_PASSWORD) - .withEnabled(true) - .build() - val config = CoreConfigurationBuilder() - .withBuildConfigClass(BuildConfig::class.java) - .withPluginConfigurations(httpSenderConfig) - .build() - ACRA.init(app, config) + Firebase.initialize(app) } fun handleException(throwable: Throwable) { - ACRA.errorReporter.handleException(throwable) + Firebase.crashlytics.recordException(throwable) } } \ No newline at end of file