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

Commit 23adb06

Browse files
authored
ProGuard/R8: use consumer rules (#55)
* Update Gradle, Android Gradle Plugin, and library versions * Add consumer ProGuard/R8 rules and disable minification for release builds
1 parent ae5d609 commit 23adb06

File tree

6 files changed

+35
-18
lines changed

6 files changed

+35
-18
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
[![Documentation](https://img.shields.io/badge/documentation-kdoc-brightgreen)](https://bitfireat.github.io/vcard4android/)
44
[![Jitpack link](https://img.shields.io/jitpack/version/com.github.bitfireAT/vcard4android)](https://jitpack.io/#bitfireAT/vcard4android)
55

6+
_This software is not affiliated to, nor has it been authorized, sponsored or otherwise approved
7+
by Google LLC. Android is a trademark of Google LLC._
8+
69

710
# vcard4android
811

@@ -13,15 +16,15 @@ It's a framework for
1316
from/into data classes that are compatible with the Android Contacts Provider, and
1417
* accessing the Android Contacts Provider by a unified API.
1518

16-
It has been primarily developed for [DAVx⁵](https://www.davx5.com) and is currently intended
17-
to be used as git submodule.
19+
It has been primarily developed for [DAVx⁵](https://www.davx5.com).
1820

19-
_This software is not affiliated to, nor has it been authorized, sponsored or otherwise approved
20-
by Google LLC. Android is a trademark of Google LLC._
21+
To view the available gradle tasks for the library: `./gradlew vcard4android:tasks`
22+
(the `vcard4android` module is defined in `settings.gradle`).
2123

2224
Generated KDoc: https://bitfireat.github.io/vcard4android/
2325

2426

27+
2528
## Contact
2629

2730
```

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[versions]
2-
agp = "8.7.1"
3-
androidx-annotation = "1.8.2"
2+
agp = "8.9.1"
3+
androidx-annotation = "1.9.1"
44
androidx-test-runner = "1.6.2"
55
androidx-rest-rules = "1.6.1"
6-
desugar = "2.1.2"
6+
desugar = "2.1.5"
77
dokka = "1.9.20"
88
ezvcard = "0.12.1"
9-
guava = "33.3.1-android"
10-
kotlin = "2.0.21"
9+
guava = "33.4.8-android"
10+
kotlin = "2.1.20"
1111
junit = "4.13.2"
1212

1313
[libraries]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

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 { *; }

settings.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ dependencyResolutionManagement {
1414
}
1515
}
1616

17-
rootProject.name = "vcard4android"
18-
include (":lib")
17+
rootProject.name = "root"
18+
include(":lib")
1919
project(":lib").name = "vcard4android"

0 commit comments

Comments
 (0)