Skip to content

Commit 758872a

Browse files
committed
Fix proguard
1 parent b2d4f3f commit 758872a

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

app/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
android {
1010
namespace = "info.hannes.github.sample"
1111
compileSdk = 36
12+
1213
defaultConfig {
1314
versionCode = getGitCommitCount()
1415
versionName = "1.0"
@@ -24,6 +25,17 @@ android {
2425
),
2526
)
2627
}
28+
29+
buildTypes {
30+
release {
31+
isMinifyEnabled = true
32+
proguardFiles(
33+
getDefaultProguardFile("proguard-android-optimize.txt"),
34+
"proguard-rules.pro",
35+
)
36+
}
37+
}
38+
2739
packaging {
2840
resources {
2941
pickFirsts += setOf("META-INF/atomicfu.kotlin_module")

app/proguard-rules.pro

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Keep Kotlin metadata annotations to avoid D8 metadata rewriting errors
2+
-keep class kotlin.Metadata { *; }
3+
-keepattributes RuntimeVisibleAnnotations
4+
5+
# Keep Kotlin coroutines
6+
-keepclassmembernames class kotlinx.** {
7+
volatile <fields>;
8+
}
9+
10+
# Keep all classes that use Kotlin metadata
11+
-keep @kotlin.Metadata class * { *; }
12+
-keep class kotlin.** { *; }
13+
-keep interface kotlin.** { *; }
14+
15+
# Don't warn about missing Kotlin classes
16+
-dontwarn kotlin.**
17+
-dontwarn kotlinx.**
18+

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ android.nonFinalResIds=false
33
android.nonTransitiveRClass=false
44
android.useAndroidX=true
55

6+
# Disable R8 Kotlin metadata rewriting to avoid D8 errors
7+
android.enableR8.fullMode=false
8+
69
org.gradle.jvmargs=-Xmx4092m

0 commit comments

Comments
 (0)