Skip to content

Commit 2fa9403

Browse files
authored
feat(app) update example app gradle to kotlin and use BGP (#2184)
1 parent f5b1753 commit 2fa9403

14 files changed

Lines changed: 319 additions & 260 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/build
1+
/build

examples/sdk-app-example/app/build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import com.bugsnag.gradle.dsl.release
2+
plugins {
3+
alias(libs.plugins.android.application)
4+
alias(libs.plugins.kotlin.android)
5+
alias(libs.plugins.kotlin.compose)
6+
alias(libs.plugins.bugsnag.gradle)
7+
}
8+
9+
android {
10+
namespace = "com.example.bugsnag.android"
11+
compileSdk = 35
12+
13+
defaultConfig {
14+
applicationId = "com.example.bugsnag.android"
15+
minSdk = 21
16+
targetSdk = 35
17+
versionCode = 1
18+
versionName = "1.0"
19+
20+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
21+
}
22+
signingConfigs {
23+
create("config") {
24+
keyAlias = "password"
25+
keyPassword = "password"
26+
storeFile = file("../fakekeys.jks")
27+
storePassword = "password"
28+
}
29+
}
30+
31+
buildTypes {
32+
release {
33+
isMinifyEnabled = true
34+
proguardFiles(
35+
getDefaultProguardFile("proguard-android-optimize.txt"),
36+
"proguard-rules.pro"
37+
)
38+
signingConfig = signingConfigs["config"]
39+
}
40+
}
41+
42+
externalNativeBuild.cmake .path = file("CMakeLists.txt")
43+
44+
compileOptions {
45+
sourceCompatibility = JavaVersion.VERSION_11
46+
targetCompatibility = JavaVersion.VERSION_11
47+
}
48+
kotlinOptions {
49+
jvmTarget = "11"
50+
}
51+
buildFeatures {
52+
compose = true
53+
buildFeatures.prefab = true
54+
packagingOptions.jniLibs.pickFirsts += mutableSetOf("**/libbugsnag-ndk.so")
55+
}
56+
}
57+
58+
bugsnag {
59+
variants {
60+
release {
61+
autoUploadBundle = true
62+
}
63+
}
64+
}
65+
66+
dependencies {
67+
androidTestImplementation(libs.androidx.espresso.core)
68+
androidTestImplementation(libs.androidx.junit)
69+
androidTestImplementation(libs.androidx.junit)
70+
androidTestImplementation(libs.androidx.ui.test.junit4)
71+
androidTestImplementation(platform(libs.androidx.compose.bom))
72+
73+
debugImplementation(libs.androidx.ui.test.manifest)
74+
debugImplementation(libs.androidx.ui.tooling)
75+
76+
implementation(kotlin("stdlib"))
77+
implementation(libs.androidx.activity.compose)
78+
implementation(libs.androidx.appcompat)
79+
implementation(libs.androidx.core.ktx)
80+
implementation(libs.androidx.lifecycle.runtime.ktx)
81+
implementation(libs.androidx.material3)
82+
implementation(libs.androidx.ui)
83+
implementation(libs.androidx.ui.graphics)
84+
implementation(libs.androidx.ui.tooling.preview)
85+
implementation(libs.bugsnag.android)
86+
implementation(libs.google.android.material)
87+
implementation(libs.bugsnag.okhttp)
88+
implementation(libs.squareup.okhttp3)
89+
implementation(platform(libs.androidx.compose.bom))
90+
91+
testImplementation(libs.junit)
92+
testImplementation(libs.junit)
93+
}

examples/sdk-app-example/app/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile

examples/sdk-app-example/build.gradle

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.kotlin.compose) apply false
6+
alias(libs.plugins.bugsnag.gradle) apply false
7+
}
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. For more details, visit
12+
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app's APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
117
android.useAndroidX=true
2-
org.gradle.jvmargs=-Xmx4096m
3-
org.gradle.parallel=true
18+
# Kotlin code style for this project: "official" or "obsolete":
419
kotlin.code.style=official
5-
android.defaults.buildfeatures.buildconfig=true
6-
android.nonTransitiveRClass=false
7-
android.nonFinalResIds=false
20+
# Enables namespacing of each library's R class so that its R class includes only the
21+
# resources declared in the library itself and none from the library's dependencies,
22+
# thereby reducing the size of the R class for that library
23+
android.nonTransitiveRClass=true
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[versions]
2+
activityCompose = "1.8.0"
3+
agp = "8.10.0"
4+
appcompat = "1.6.1"
5+
bugsnag-android = "6.13.0"
6+
bugsnag-gradle = "0.4.0"
7+
composeBom = "2024.09.00"
8+
coreKtx = "1.16.0"
9+
espressoCore = "3.6.1"
10+
google-android-material = "1.11.0"
11+
junit = "4.13.2"
12+
junitVersion = "1.2.1"
13+
kotlin = "2.0.21"
14+
lifecycleRuntimeKtx = "2.6.1"
15+
squareup-okhttp3 = "4.12.0"
16+
17+
[libraries]
18+
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
19+
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat"}
20+
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
21+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
22+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
23+
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
24+
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
25+
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
26+
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
27+
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
28+
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
29+
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
30+
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
31+
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
32+
bugsnag-android = { group = "com.bugsnag", name = "bugsnag-android", version.ref = "bugsnag-android"}
33+
bugsnag-okhttp = {group = "com.bugsnag", name = "bugsnag-plugin-android-okhttp", version.ref = "bugsnag-android"}
34+
google-android-material = { group = "com.google.android.material", name = "material", version.ref = "google-android-material"}
35+
junit = { group = "junit", name = "junit", version.ref = "junit" }
36+
squareup-okhttp3 = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "squareup-okhttp3"}
37+
38+
[plugins]
39+
android-application = { id = "com.android.application", version.ref = "agp" }
40+
bugsnag-gradle = { id = "com.bugsnag.gradle", version.ref = "bugsnag-gradle"}
41+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
42+
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
-333 Bytes
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Fri May 16 10:34:05 BST 2025
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)