Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit aacd85f

Browse files
committed
Add consumer ProGuard/R8 rules and disable minification for release builds
1 parent 24472ba commit aacd85f

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

lib/build.gradle.kts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ android {
1616
aarMetadata {
1717
minCompileSdk = 29
1818
}
19+
20+
// These ProGuard/R8 rules will be included in the final APK.
21+
consumerProguardFiles("consumer-rules.pro")
1922
}
2023

2124
compileOptions {
@@ -25,18 +28,21 @@ android {
2528
jvmToolchain(21)
2629
}
2730

28-
buildTypes {
29-
release {
30-
isMinifyEnabled = false
31-
}
32-
}
33-
3431
packaging {
3532
resources {
3633
excludes += listOf("LICENSE", "META-INF/LICENSE.txt", "META-INF/NOTICE.txt")
3734
}
3835
}
3936

37+
buildTypes {
38+
release {
39+
// Android libraries shouldn't be minified:
40+
// https://developer.android.com/studio/projects/android-library#Considerations
41+
isMinifyEnabled = false
42+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
43+
}
44+
}
45+
4046
lint {
4147
disable += listOf("AllowBackup", "InvalidPackage")
4248
}

lib/consumer-rules.pro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# keep all vCard properties/parameters (used via reflection)
3+
-keep class ezvcard.io.scribe.** { *; }
4+
-keep class ezvcard.property.** { *; }
5+
-keep class ezvcard.parameter.** { *; }
6+
7+
# AGP seems to remove this class, but ezvcard.io uses it. See https://github.com/bitfireAT/davx5/issues/499
8+
-keep class javax.xml.namespace.QName { *; }

0 commit comments

Comments
 (0)