Skip to content

Commit 8d67d97

Browse files
authored
Merge pull request #5 from frogermcs/feature/proguard
init config for proguard
2 parents b210089 + d948de1 commit 8d67d97

File tree

2 files changed

+89
-23
lines changed

2 files changed

+89
-23
lines changed

app/build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ android {
1212

1313
buildTypes {
1414
debug {
15-
minifyEnabled false
15+
minifyEnabled true
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'),
17+
'proguard-rules.pro'
1618
}
1719

1820
release {
1921
minifyEnabled true
20-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22+
proguardFile 'proguard-rules.pro'
23+
proguardFile getDefaultProguardFile('proguard-android.txt')
2124
}
2225
}
26+
27+
packagingOptions {
28+
exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
29+
}
2330
}
2431

2532
dependencies {

app/proguard-rules.pro

Lines changed: 80 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,80 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
1+
# === RxJava ===
2+
3+
-dontwarn sun.misc.**
4+
5+
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
6+
long producerIndex;
7+
long consumerIndex;
8+
}
9+
10+
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
11+
rx.internal.util.atomic.LinkedQueueNode producerNode;
12+
}
13+
14+
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
15+
rx.internal.util.atomic.LinkedQueueNode consumerNode;
16+
}
17+
18+
-dontnote rx.internal.util.PlatformDependent
19+
20+
# ===endof RxJava ===
21+
22+
23+
# === OkHttp ===
24+
25+
# JSR 305 annotations are for embedding nullability information.
26+
-dontwarn javax.annotation.**
27+
28+
# A resource is loaded with a relative path so the package of this class must be preserved.
29+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
30+
31+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
32+
-dontwarn org.codehaus.mojo.animal_sniffer.*
33+
34+
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
35+
-dontwarn okhttp3.internal.platform.ConscryptPlatform
36+
37+
# ===endof OkHttp ===
38+
39+
40+
# === Retrofit ===
41+
42+
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
43+
# EnclosingMethod is required to use InnerClasses.
44+
-keepattributes Signature, InnerClasses, EnclosingMethod
45+
46+
# Retain service method parameters when optimizing.
47+
-keepclassmembers,allowshrinking,allowobfuscation interface * {
48+
@retrofit2.http.* <methods>;
49+
}
50+
51+
# Ignore annotation used for build tooling.
52+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
53+
54+
# Ignore JSR 305 annotations for embedding nullability information.
55+
-dontwarn javax.annotation.**
56+
57+
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
58+
-dontwarn kotlin.Unit
59+
60+
# Top-level functions that can only be used by Kotlin.
61+
-dontwarn retrofit2.-KotlinExtensions
62+
63+
# ===endof Retrofit ===
64+
65+
66+
# === Dagger ====
67+
68+
-dontwarn com.google.errorprone.annotations.**
69+
-dontwarn com.squareup.javawriter.**
70+
71+
# ===endof Dagger ===
72+
73+
74+
# === Google autofactory ===
75+
76+
-dontwarn com.google.googlejavaformat.**
77+
-dontwarn com.google.common.**
78+
-dontwarn com.google.auto.**
79+
80+
# ===endof Google autofactory ===

0 commit comments

Comments
 (0)