aboutsummaryrefslogtreecommitdiff
path: root/core/proguard_basic_keeps.flags
blob: 30c2341649c2258c34b82441a2d1e1b28cd2d3df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Some classes in the libraries extend package private classes to chare common functionality
# that isn't explicitly part of the API
-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames,includedescriptorclasses class * {
    native <methods>;
}

# class$ methods are inserted by some compilers to implement .class construct,
# see http://proguard.sourceforge.net/manual/examples.html#library
-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

# Keep serializable classes and necessary members for serializable classes
# Copied from the ProGuard manual at http://proguard.sourceforge.net.
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# Keep Throwable's constructor that takes a String argument.
-keepclassmembers class * extends java.lang.Throwable {
  <init>(java.lang.String);
}

# Please specify classes to be kept explicitly in your package's configuration.
# -keep class * extends android.app.Activity
# -keep class * extends android.view.View
# -keep class * extends android.app.Service
# -keep class * extends android.content.BroadcastReceiver
# -keep class * extends android.content.ContentProvider
# -keep class * extends android.preference.Preference
# -keep class * extends android.app.BackupAgent

# Parcelable CREATORs must be kept for Parcelable functionality
-keep class * implements android.os.Parcelable {
  public static final ** CREATOR;
}

# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
# See proguard-android.txt in the SDK package.
#
# DO NOT USE THIS: We figured it's dangerous to blindly ignore all support library warnings.
# ProGuard may strip members of subclass of unknown super classes, in case an app is linking against
# LOCAL_SDK_VERSION lower than the support library's LOCAL_SDK_VERSION.
# See bug/20658265.
# -dontwarn android.support.**

# From https://github.com/google/guava/wiki/UsingProGuardWithGuava
# Striped64, LittleEndianByteArray, UnsignedBytes, AbstractFuture
-dontwarn sun.misc.Unsafe
# Futures.getChecked (which often won't work with Proguard anyway) uses this. It
# has a fallback, but again, don't use Futures.getChecked on Android regardless.
-dontwarn java.lang.ClassValue

# Less spammy.
-dontnote

# The lite proto runtime uses reflection to access fields based on the names in
# the schema, keep all the fields.
-keepclassmembers class * extends com.google.protobuf.MessageLite { <fields>; }