Add crashlytics (#87)

* Add crashlytics

* Add google services json to ci env
This commit is contained in:
timklge 2025-04-10 18:14:05 +02:00 committed by GitHub
parent efaa8efc2c
commit 9306ba29cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 37 additions and 1 deletions

View File

@ -25,6 +25,7 @@ jobs:
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
echo "KEYSTORE_BASE64=${{ secrets.KEYSTORE_BASE64 }}" >> $GITHUB_ENV echo "KEYSTORE_BASE64=${{ secrets.KEYSTORE_BASE64 }}" >> $GITHUB_ENV
echo "GOOGLE_SERVICES_JSON_BASE64=${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV echo "BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: set up JDK 17 - name: set up JDK 17

View File

@ -57,6 +57,10 @@ If the app cannot connect to the weather service, it will retry the download eve
- Interfaces with [openweathermap.org](https://openweathermap.org) - Interfaces with [openweathermap.org](https://openweathermap.org)
- Uses [karoo-ext](https://github.com/hammerheadnav/karoo-ext) (Apache2-licensed) - Uses [karoo-ext](https://github.com/hammerheadnav/karoo-ext) (Apache2-licensed)
## Crashlytics
This app uses Google Crashlytics for crash reporting to help improve stability and performance.
## Extension Developers: Headwind Data Type ## Extension Developers: Headwind Data Type
If the user has installed the headwind extension on his karoo, you can stream the headwind data type from other extensions via `karoo-ext`. If the user has installed the headwind extension on his karoo, you can stream the headwind data type from other extensions via `karoo-ext`.

1
app/.gitignore vendored
View File

@ -1 +1,2 @@
/build /build
/google-services.json

View File

@ -5,6 +5,8 @@ plugins {
alias(libs.plugins.jetbrains.kotlin.android) alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.compose.compiler) alias(libs.plugins.compose.compiler)
kotlin("plugin.serialization") version "2.0.20" kotlin("plugin.serialization") version "2.0.20"
alias(libs.plugins.google.gms.google.services)
alias(libs.plugins.google.firebase.crashlytics)
} }
android { android {
@ -55,6 +57,24 @@ android {
} }
} }
tasks.register("addGoogleServicesJson") {
description = "Adds google-services.json to the project"
group = "build"
doLast {
val googleServicesJson = System.getenv("GOOGLE_SERVICES_JSON_BASE64")
?.let { Base64.getDecoder().decode(it) }
?.let { String(it) }
if (googleServicesJson != null) {
val jsonFile = file("$projectDir/google-services.json")
jsonFile.writeText(googleServicesJson)
println("Added google-services.json to the project")
} else {
println("No GOOGLE_SERVICES_JSON_BASE64 environment variable found, skipping...")
}
}
}
tasks.register("generateManifest") { tasks.register("generateManifest") {
description = "Generates manifest.json with current version information" description = "Generates manifest.json with current version information"
group = "build" group = "build"
@ -85,6 +105,7 @@ tasks.register("generateManifest") {
tasks.named("assemble") { tasks.named("assemble") {
dependsOn("generateManifest") dependsOn("generateManifest")
dependsOn("addGoogleServicesJson")
} }
dependencies { dependencies {
@ -99,4 +120,5 @@ dependencies {
implementation(libs.androidx.glance.appwidget) implementation(libs.androidx.glance.appwidget)
implementation(libs.androidx.glance.appwidget.preview) implementation(libs.androidx.glance.appwidget.preview)
implementation(libs.androidx.glance.preview) implementation(libs.androidx.glance.preview)
implementation(libs.firebase.crashlytics)
} }

View File

@ -3,4 +3,6 @@ plugins {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.google.gms.google.services) apply false
alias(libs.plugins.google.firebase.crashlytics) apply false
} }

View File

@ -11,11 +11,16 @@ androidxComposeMaterial = "1.3.1"
glance = "1.1.1" glance = "1.1.1"
kotlinxSerializationJson = "1.8.0" kotlinxSerializationJson = "1.8.0"
mapboxSdkTurf = "7.3.1" mapboxSdkTurf = "7.3.1"
firebaseCrashlytics = "19.4.2"
googleGmsGoogleServices = "4.4.2"
googleFirebaseCrashlytics = "3.0.3"
[plugins] [plugins]
android-application = { id = "com.android.application", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
google-gms-google-services = { id = "com.google.gms.google-services", version.ref = "googleGmsGoogleServices" }
google-firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "googleFirebaseCrashlytics" }
[libraries] [libraries]
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
@ -38,6 +43,7 @@ androidx-glance-appwidget-preview = { group = "androidx.glance", name = "glance-
androidx-glance-preview = { group = "androidx.glance", name = "glance-preview", version.ref = "glance" } androidx-glance-preview = { group = "androidx.glance", name = "glance-preview", version.ref = "glance" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
mapbox-sdk-turf = { module = "com.mapbox.mapboxsdk:mapbox-sdk-turf", version.ref = "mapboxSdkTurf" } mapbox-sdk-turf = { module = "com.mapbox.mapboxsdk:mapbox-sdk-turf", version.ref = "mapboxSdkTurf" }
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics", version.ref = "firebaseCrashlytics" }
[bundles] [bundles]
androidx-lifeycle = ["androidx-lifecycle-runtime-compose", "androidx-lifecycle-viewmodel-compose"] androidx-lifeycle = ["androidx-lifecycle-runtime-compose", "androidx-lifecycle-viewmodel-compose"]