proguard-project.txt 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. # To enable ProGuard in your project, edit project.properties
  2. # to define the proguard.config property as described in that file.
  3. #
  4. # Add project specific ProGuard rules here.
  5. # By default, the flags in this file are appended to flags specified
  6. # in ${sdk.dir}/tools/proguard/proguard-android.txt
  7. # You can edit the include path and order by changing the ProGuard
  8. # include property in project.properties.
  9. #
  10. # For more details, see
  11. # http://developer.android.com/guide/developing/tools/proguard.html
  12. # Add any project specific keep options here:
  13. # If your project uses WebView with JS, uncomment the following
  14. # and specify the fully qualified class name to the JavaScript interface
  15. # class:
  16. #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  17. # public *;
  18. #}
  19. -dontpreverify
  20. #-flattenpackagehierarchy
  21. -repackageclasses
  22. -optimizationpasses 5
  23. -dontusemixedcaseclassnames
  24. -dontskipnonpubliclibraryclasses
  25. -dontskipnonpubliclibraryclassmembers
  26. -allowaccessmodification
  27. -verbose
  28. -keeppackagenames ch.threema.**
  29. -keeppackagenames org.saltyrtc.**
  30. -dontnote android.net.http.*
  31. -dontnote org.apache.commons.codec.**
  32. -dontnote org.apache.http.**
  33. # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
  34. -keepclasseswithmembernames class * {
  35. native <methods>;
  36. }
  37. -keepclasseswithmembers class * {
  38. public <init>(android.content.Context, android.util.AttributeSet);
  39. }
  40. -keepclasseswithmembers class * {
  41. public <init>(android.content.Context, android.util.AttributeSet, int);
  42. }
  43. # We want to keep methods in Activity that could be used in the XML attribute onClick
  44. -keepclassmembers class * extends android.app.Activity {
  45. public void *(android.view.View);
  46. }
  47. # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
  48. -keepclassmembers enum * {
  49. public static **[] values();
  50. public static ** valueOf(java.lang.String);
  51. }
  52. # for google play services
  53. -keep class * extends java.util.ListResourceBundle {
  54. protected java.lang.Object[][] getContents();
  55. }
  56. # Keep SafeParcelable value, needed for reflection. This is required to support backwards
  57. # compatibility of some classes.
  58. -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
  59. public static final *** NULL;
  60. }
  61. # Keep the names of classes/members we need for client functionality.
  62. -keepnames @com.google.android.gms.common.annotation.KeepName class *
  63. -keepclassmembernames class * {
  64. @com.google.android.gms.common.annotation.KeepName *;
  65. }
  66. # config needed for sqlcipher
  67. -keep class * implements android.os.Parcelable {
  68. public static final android.os.Parcelable$Creator *;
  69. }
  70. -keepclassmembers class **.R$* {
  71. public static <fields>;
  72. }
  73. # SQLCipher
  74. -keep,includedescriptorclasses class net.sqlcipher.** { *; }
  75. -keep,includedescriptorclasses interface net.sqlcipher.** { *; }
  76. # for zxing
  77. -keep class com.google.zxing.client.android.camera.open.**
  78. -keep class com.google.zxing.client.android.camera.exposure.**
  79. -keep class com.google.zxing.client.android.common.executor.**
  80. # As described in tools/proguard/examples/android.pro - ignore all warnings.
  81. #-dontwarn android.support.v4.**
  82. # Missing annotations are harmless.
  83. -dontwarn sun.misc.Unsafe
  84. -dontwarn javax.annotation.**
  85. # Ignore invalid constant ref. See
  86. # https://groups.google.com/d/topic/guava-discuss/YCZzeCiIVoI/discussion
  87. -dontwarn com.google.common.collect.MinMaxPriorityQueue
  88. # threema-specific
  89. -dontwarn org.mockito.**
  90. -dontwarn sun.reflect.**
  91. -dontwarn android.test.**
  92. -dontwarn class.org.junit.**
  93. -dontwarn android.app.**
  94. -dontwarn android.support.**
  95. -dontwarn android.view.**
  96. -dontwarn android.widget.**
  97. -dontwarn com.google.common.primitives.**
  98. -dontwarn **CompatHoneycomb
  99. -dontwarn **CompatHoneycombMR2
  100. -dontwarn **CompatCreatorHoneycombMR2
  101. -dontwarn java.beans.**
  102. # WebRTC fails to build due to missing dependencies
  103. # "Warning: org.webrtc.SoftwareVideoDecoderFactory: can't find referenced class org.webrtc.LibvpxVp8Decoder"
  104. -dontwarn org.webrtc.**
  105. -keepattributes EnclosingMethod
  106. -keepattributes InnerClasses
  107. # hms requirements
  108. -ignorewarnings
  109. -keepattributes Exceptions
  110. -keep class com.huawei.updatesdk.**{*;}
  111. -keep class com.huawei.hms.**{*;}
  112. -keep class com.huawei.android.sdk.drm.**{*;}
  113. # remove android log calls below error
  114. -assumenosideeffects class android.util.Log {
  115. public static *** v(...);
  116. public static *** d(...);
  117. public static *** i(...);
  118. public static *** w(...);
  119. }
  120. # remaining options from proguard-android-optimize.txt
  121. -renamesourcefileattribute SourceFile
  122. -keepattributes *Annotation*,SourceFile,LineNumberTable
  123. -keep public class com.google.android.vending.licensing.ILicensingService
  124. # keep setters in Views so that animations can still work.
  125. # see http://proguard.sourceforge.net/manual/examples.html#beans
  126. -keepclassmembers public class * extends android.view.View {
  127. void set*(***);
  128. *** get*();
  129. }
  130. -keepnames class com.fasterxml.jackson.** { *; }
  131. -keepnames interface com.fasterxml.jackson.** { *; }
  132. -keep class org.codehaus.** { *; }
  133. -dontwarn org.w3c.dom.**
  134. -dontwarn de.tavendo.autobahn.**
  135. -dontwarn com.fasterxml.jackson.databind.ext.PathDeserializer**
  136. # Msgpack
  137. -keep class org.msgpack.core.** { *; }
  138. -keep class org.msgpack.value.** { *; }
  139. # SLF4J
  140. -keep class org.slf4j.**
  141. -dontwarn org.slf4j.impl.StaticMDCBinder
  142. -dontwarn org.slf4j.impl.StaticMarkerBinder
  143. -dontwarn org.slf4j.impl.StaticLoggerBinder
  144. -keepattributes *Annotation*
  145. # WebRTC
  146. -keep class org.webrtc.** { *; }
  147. # Messages are serialized using reflection
  148. -keep class ch.threema.app.webclient.messages.** { *; }
  149. # Keep our own searchview visible
  150. -keep public class * extends androidx.appcompat.widget.SearchView {*;}
  151. # https://stackoverflow.com/questions/44145786/thousands-of-strange-crashes-in-new-google-play-console-version
  152. -keep class * extends android.app.Application {*;}
  153. # from https://github.com/ohmae/preference-activity-compat
  154. -keep public class * extends androidx.preference.PreferenceFragmentCompat
  155. # https://stackoverflow.com/questions/51006967/androidx-build-fails-in-release-mode-regarding-appcomponentfactory
  156. -keep class androidx.core.app.CoreComponentFactory { *; }
  157. # Firebase analytics removal
  158. -dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
  159. # keep camera classes - 1.0.0-alpha03 causes VerifyError in Android 4.4
  160. -keep class androidx.camera.** { *; }
  161. # protobuf uses reflection
  162. -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  163. <fields>;
  164. }
  165. # glide image loading
  166. -keep public class * implements com.bumptech.glide.module.GlideModule
  167. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  168. <init>(...);
  169. }
  170. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  171. **[] $VALUES;
  172. public *;
  173. }
  174. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  175. *** rewind();
  176. }
  177. # For reasons unknown to us, starting with the 4.5 release branch, a release build
  178. # would throw an exception on app start:
  179. #
  180. # java.lang.VerifyError: Verifier rejected class ch.threema.client.f1:
  181. # void ch.threema.client.f1.d(ch.threema.client.x0) failed to verify: void ch.threema.client.f1.d(ch.threema.client.x0):
  182. # [0x1A3] expected to be within a catch-all for an instruction where a monitor is held (declaration of 'ch.threema.client.f1' appears in base.apk)
  183. #
  184. # Adding this line fixes the problem. It's most probably a bug in the R8 optimizer
  185. # that's triggered by this file, the NonceFactory wasn't modified since 2017...
  186. # Maybe we can remove this again with a future build toolchain.
  187. -keep class ch.threema.base.crypto.NonceFactory { *; }
  188. -dontwarn build.IgnoreJava8API
  189. -dontwarn sun.security.x509.X509Key
  190. # https://issuetracker.google.com/issues/159595260
  191. -keep class * extends androidx.startup.Initializer {
  192. <init>();
  193. }