Skip to content

Commit 333a5a4

Browse files
Merge pull request #89 from apivideo/fix/proguard_rules
Fix/proguard rules
2 parents 33c7f0e + eac6dfc commit 333a5a4

File tree

9 files changed

+54
-12
lines changed

9 files changed

+54
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.3.5] - 2024-03-21
5+
- Add missing proguard rules for gson and jackson
6+
47
## [1.3.4] - 2024-01-08
58
- Upgrade dependencies, gradle and Kotlin
69

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Add this dependency to your project's POM:
6262
<dependency>
6363
<groupId>video.api</groupId>
6464
<artifactId>android-video-uploader</artifactId>
65-
<version>1.3.4</version>
65+
<version>1.3.5</version>
6666
<scope>compile</scope>
6767
</dependency>
6868
```
@@ -72,7 +72,7 @@ Add this dependency to your project's POM:
7272
Add this dependency to your project's build file:
7373

7474
```groovy
75-
implementation "video.api:android-video-uploader:1.3.4"
75+
implementation "video.api:android-video-uploader:1.3.5"
7676
```
7777

7878
#### Others
@@ -85,7 +85,7 @@ mvn clean package
8585

8686
Then manually install the following JARs:
8787

88-
* `target/android-video-uploader-1.3.4.jar`
88+
* `target/android-video-uploader-1.3.5.jar`
8989
* `target/lib/*.jar`
9090

9191
### Code sample

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'maven-publish'
55
apply plugin: 'kotlin-android'
66

77
group = 'video.api'
8-
version = '1.3.4'
8+
version = '1.3.5'
99

1010
buildscript {
1111
repositories {

consumer-rules.pro

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,48 @@
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
2222

23-
# Workaround for internal missing proguard rules
23+
## Workaround for internal missing proguard rules
2424
-dontwarn aQute.bnd.annotation.spi.ServiceProvider
2525
-dontwarn jakarta.validation.valueextraction.UnwrapByDefault
2626
-dontwarn jakarta.validation.valueextraction.ValueExtractor
2727
-dontwarn javax.validation.valueextraction.UnwrapByDefault
28-
-dontwarn javax.validation.valueextraction.ValueExtractor
28+
-dontwarn javax.validation.valueextraction.ValueExtractor
29+
30+
## Proguard configuration for Gson
31+
# Gson uses generic type information stored in a class file when working with fields. Proguard
32+
# removes such information by default, so configure it to keep all of it.
33+
-keepattributes Signature
34+
35+
# For using GSON @Expose annotation
36+
-keepattributes *Annotation*
37+
38+
# Gson specific classes
39+
-dontwarn sun.misc.**
40+
#-keep class com.google.gson.stream.** { *; }
41+
42+
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
43+
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
44+
-keep class * extends com.google.gson.TypeAdapter
45+
-keep class * implements com.google.gson.TypeAdapterFactory
46+
-keep class * implements com.google.gson.JsonSerializer
47+
-keep class * implements com.google.gson.JsonDeserializer
48+
49+
# Prevent R8 from leaving Data object members always null
50+
-keep class * {
51+
@com.google.gson.annotations.SerializedName <fields>;
52+
}
53+
54+
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
55+
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
56+
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
57+
58+
## Proguard configuration for Jackson 2.x (fasterxml package instead of codehaus package)
59+
-keep class com.fasterxml.jackson.databind.ObjectMapper {
60+
public <methods>;
61+
protected <methods>;
62+
}
63+
-keep class com.fasterxml.jackson.databind.ObjectWriter {
64+
public ** writeValueAsString(**);
65+
}
66+
-keepnames class com.fasterxml.jackson.** { *; }
67+
-dontwarn com.fasterxml.jackson.databind.**

examples/service/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ android {
1919

2020
buildTypes {
2121
release {
22-
minifyEnabled false
22+
minifyEnabled true
2323
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2424
}
2525
}

examples/workmanager/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ android {
1919

2020
buildTypes {
2121
release {
22-
minifyEnabled false
22+
minifyEnabled true
2323
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2424
}
2525
}

maven-push.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ apply plugin: 'maven-publish'
1818
apply plugin: 'signing'
1919

2020
def isReleaseBuild() {
21-
return !"1.3.4".contains("SNAPSHOT")
21+
return !"1.3.5".contains("SNAPSHOT")
2222
}
2323

2424
def getReleaseRepositoryUrl() {
@@ -57,7 +57,7 @@ afterEvaluate {
5757

5858
groupId = "video.api"
5959
artifactId = "android-video-uploader"
60-
version = "1.3.4"
60+
version = "1.3.5"
6161

6262
pom {
6363
name = "video.api:android-video-uploader"

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>android-video-uploader</artifactId>
66
<packaging>jar</packaging>
77
<name>${project.groupId}:${project.artifactId}</name>
8-
<version>1.3.4</version>
8+
<version>1.3.5</version>
99
<url>https://github.com/apivideo/api.video-android-uploader</url>
1010
<description>The official Android api.video uploader</description>
1111
<scm>

src/main/java/video/api/uploader/api/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private OkHttpClient initHttpClient(List<Interceptor> interceptors) {
118118
private void init() {
119119
verifyingSsl = true;
120120
json = new JSON();
121-
addDefaultHeader("AV-Origin-Client", "android-uploader:1.3.4");
121+
addDefaultHeader("AV-Origin-Client", "android-uploader:1.3.5");
122122
}
123123

124124
private boolean isValid(String regex, String field) {

0 commit comments

Comments
 (0)