Skip to content

Commit 21dd2f3

Browse files
authored
Merge pull request #476 from microsoftgraph/feature/proguard-rules
- fixes #462 adds sample proguard rules
2 parents 1f3e2fd + 4b4783b commit 21dd2f3

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Add the dependency in `dependencies` in pom.xml
3737

3838
### 1.3 Enable ProGuard (Android)
3939

40-
The nature of the Graph API is such that the SDK needs quite a large set of classes to describe its functionality. You need to ensure that [ProGuard](https://developer.android.com/studio/build/shrink-code.html) is enabled on your project. Otherwise, you will incur long build times for functionality that is not necessarily relevant to your particular application. If you are still hitting the 64K method limit, you can also enable [multidexing](https://developer.android.com/studio/build/multidex.html).
40+
The nature of the Graph API is such that the SDK needs quite a large set of classes to describe its functionality. You need to ensure that [ProGuard](https://developer.android.com/studio/build/shrink-code.html) is enabled on your project. Otherwise, you will incur long build times for functionality that is not necessarily relevant to your particular application. If you are still hitting the 64K method limit, you can also enable [multidexing](https://developer.android.com/studio/build/multidex.html). Checkout the [recommended rules](./docs/proguard-rules.txt).
4141

4242
## 2. Getting started
4343

docs/proguard-rules.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
-keep class com.microsoft.** { *; }
2+
3+
## GSON 2.2.4 specific rules ##
4+
# Source: https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
5+
# Gson uses generic type information stored in a class file when working with fields. Proguard
6+
# removes such information by default, so configure it to keep all of it.
7+
-keepattributes Signature
8+
# For using GSON @Expose annotation
9+
-keepattributes *Annotation*
10+
-keepattributes EnclosingMethod
11+
# Gson specific classes
12+
-keep class sun.misc.Unsafe { *; }
13+
-keep class com.google.gson.stream.** { *; }
14+
# Gson specific classes used by Broker.
15+
-keep class * implements com.google.gson.TypeAdapterFactory
16+
-keep class * implements com.google.gson.JsonSerializer
17+
-keep class * implements com.google.gson.JsonDeserializer
18+
19+
-dontnote sun.misc.Unsafe
20+
-dontnote com.google.gson.**
21+
22+
# JUnit
23+
-dontwarn org.junit.**
24+
-dontwarn junit.**
25+
26+
# okhttp
27+
28+
-keepattributes Signature
29+
-keepattributes *Annotation*
30+
-keep class okhttp3.** { *; }
31+
-keep interface okhttp3.** { *; }
32+
-dontwarn okhttp3.**
33+
34+
# okio
35+
36+
-keep class sun.misc.Unsafe { *; }
37+
-dontwarn java.nio.file.*
38+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
39+
-dontwarn okio.**

0 commit comments

Comments
 (0)