proguard-project.txt 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. # Fix bug on Samsung, Wiko (and other) devices running Android 4.2
  34. # See also: https://code.google.com/p/android/issues/detail?id=78377
  35. # http://stackoverflow.com/questions/24809580/noclassdeffounderror-android-support-v7-internal-view-menu-menubuilder/26641388#26641388
  36. # new version for appcompat >=23.1.1
  37. #-keep class !android.support.v7.view.menu.*MenuBuilder*, android.support.v7.** { *; }
  38. #-keep interface android.support.v7.** { *; }
  39. #-dontwarn android.support.v7.**
  40. # See: https://stackoverflow.com/questions/30562330/using-appcompat-layout-behavior-with-string-appbar-scrolling-view-behavior
  41. #-keep class com.google.android.material.** { *; }
  42. #-keep interface com.google.android.material.** { *; }
  43. #-dontwarn android.support.design.**
  44. # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
  45. -keepclasseswithmembernames class * {
  46. native <methods>;
  47. }
  48. -keepclasseswithmembers class * {
  49. public <init>(android.content.Context, android.util.AttributeSet);
  50. }
  51. -keepclasseswithmembers class * {
  52. public <init>(android.content.Context, android.util.AttributeSet, int);
  53. }
  54. # We want to keep methods in Activity that could be used in the XML attribute onClick
  55. -keepclassmembers class * extends android.app.Activity {
  56. public void *(android.view.View);
  57. }
  58. # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
  59. -keepclassmembers enum * {
  60. public static **[] values();
  61. public static ** valueOf(java.lang.String);
  62. }
  63. # for google play services
  64. -keep class * extends java.util.ListResourceBundle {
  65. protected java.lang.Object[][] getContents();
  66. }
  67. # Keep SafeParcelable value, needed for reflection. This is required to support backwards
  68. # compatibility of some classes.
  69. -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
  70. public static final *** NULL;
  71. }
  72. # Keep the names of classes/members we need for client functionality.
  73. -keepnames @com.google.android.gms.common.annotation.KeepName class *
  74. -keepclassmembernames class * {
  75. @com.google.android.gms.common.annotation.KeepName *;
  76. }
  77. # config needed for sqlcipher
  78. -keep class * implements android.os.Parcelable {
  79. public static final android.os.Parcelable$Creator *;
  80. }
  81. -keepclassmembers class **.R$* {
  82. public static <fields>;
  83. }
  84. # SQLCipher
  85. -keep,includedescriptorclasses class net.sqlcipher.** { *; }
  86. -keep,includedescriptorclasses interface net.sqlcipher.** { *; }
  87. # for zxing
  88. -keep class com.google.zxing.client.android.camera.open.**
  89. -keep class com.google.zxing.client.android.camera.exposure.**
  90. -keep class com.google.zxing.client.android.common.executor.**
  91. # As described in tools/proguard/examples/android.pro - ignore all warnings.
  92. #-dontwarn android.support.v4.**
  93. # Missing annotations are harmless.
  94. -dontwarn sun.misc.Unsafe
  95. -dontwarn javax.annotation.**
  96. # Ignore invalid constant ref. See
  97. # https://groups.google.com/d/topic/guava-discuss/YCZzeCiIVoI/discussion
  98. -dontwarn com.google.common.collect.MinMaxPriorityQueue
  99. # threema-specific
  100. -dontwarn org.mockito.**
  101. -dontwarn sun.reflect.**
  102. -dontwarn android.test.**
  103. -dontwarn class.org.junit.**
  104. -dontwarn android.app.**
  105. -dontwarn android.support.**
  106. -dontwarn android.view.**
  107. -dontwarn android.widget.**
  108. -dontwarn com.google.common.primitives.**
  109. -dontwarn **CompatHoneycomb
  110. -dontwarn **CompatHoneycombMR2
  111. -dontwarn **CompatCreatorHoneycombMR2
  112. -dontwarn java.beans.**
  113. # WebRTC fails to build due to missing dependencies
  114. # "Warning: org.webrtc.SoftwareVideoDecoderFactory: can't find referenced class org.webrtc.LibvpxVp8Decoder"
  115. -dontwarn org.webrtc.**
  116. -keepattributes EnclosingMethod
  117. -keepattributes InnerClasses
  118. # hms requirements
  119. -ignorewarnings
  120. -keepattributes Exceptions
  121. -keep class com.huawei.updatesdk.**{*;}
  122. -keep class com.huawei.hms.**{*;}
  123. -keep class com.huawei.android.sdk.drm.**{*;}
  124. # remove android log calls below error
  125. -assumenosideeffects class android.util.Log {
  126. public static *** v(...);
  127. public static *** d(...);
  128. public static *** i(...);
  129. public static *** w(...);
  130. }
  131. # remaining options from proguard-android-optimize.txt
  132. -renamesourcefileattribute SourceFile
  133. -keepattributes *Annotation*,SourceFile,LineNumberTable
  134. -keep public class com.google.android.vending.licensing.ILicensingService
  135. # keep setters in Views so that animations can still work.
  136. # see http://proguard.sourceforge.net/manual/examples.html#beans
  137. -keepclassmembers public class * extends android.view.View {
  138. void set*(***);
  139. *** get*();
  140. }
  141. # Jackson
  142. -keepattributes Signature,*Annotation*,EnclosingMethod
  143. -keep class com.fasterxml.jackson.databind.ObjectMapper {
  144. public <methods>;
  145. protected <methods>;
  146. }
  147. -keep class com.fasterxml.jackson.databind.ObjectWriter {
  148. public ** writeValueAsString(**);
  149. }
  150. -keepnames class com.fasterxml.jackson.** { *; }
  151. -keepnames interface com.fasterxml.jackson.** { *; }
  152. -keep class org.codehaus.** { *; }
  153. -dontwarn org.w3c.dom.**
  154. -dontwarn de.tavendo.autobahn.**
  155. -dontwarn com.fasterxml.jackson.databind.ext.PathDeserializer**
  156. # Msgpack
  157. -keep class org.msgpack.core.** { *; }
  158. -keep class org.msgpack.value.** { *; }
  159. # SLF4J
  160. -keep class org.slf4j.**
  161. -dontwarn org.slf4j.impl.StaticMDCBinder
  162. -dontwarn org.slf4j.impl.StaticMarkerBinder
  163. -dontwarn org.slf4j.impl.StaticLoggerBinder
  164. -keepattributes *Annotation*
  165. # WebRTC
  166. -keep class org.webrtc.** { *; }
  167. # Messages are serialized using reflection
  168. -keep class ch.threema.app.webclient.messages.** { *; }
  169. # Keep our own searchview visible
  170. -keep public class * extends androidx.appcompat.widget.SearchView {*;}
  171. # https://stackoverflow.com/questions/44145786/thousands-of-strange-crashes-in-new-google-play-console-version
  172. -keep class * extends android.app.Application {*;}
  173. # from https://github.com/ohmae/preference-activity-compat
  174. -keep public class * extends androidx.preference.PreferenceFragmentCompat
  175. # https://stackoverflow.com/questions/51006967/androidx-build-fails-in-release-mode-regarding-appcomponentfactory
  176. -keep class androidx.core.app.CoreComponentFactory { *; }
  177. # Firebase analytics removal
  178. -dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
  179. # keep camera classes - 1.0.0-alpha03 causes VerifyError in Android 4.4
  180. -keep class androidx.camera.** { *; }
  181. # respect DoNotOptimize annotations in soloader used by mapbox - causes VerifyError in Android 4.4
  182. -keep,allowobfuscation @interface com.facebook.soloader.DoNotOptimize
  183. -keep @com.facebook.soloader.DoNotOptimize class *
  184. -keepclassmembers class * {
  185. @com.facebook.soloader.DoNotOptimize *;
  186. }
  187. # protobuf uses reflection
  188. -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  189. <fields>;
  190. }
  191. # glide image loading
  192. -keep public class * implements com.bumptech.glide.module.GlideModule
  193. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  194. <init>(...);
  195. }
  196. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  197. **[] $VALUES;
  198. public *;
  199. }
  200. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  201. *** rewind();
  202. }
  203. # For reasons unknown to us, starting with the 4.5 release branch, a release build
  204. # would throw an exception on app start:
  205. #
  206. # java.lang.VerifyError: Verifier rejected class ch.threema.client.f1:
  207. # void ch.threema.client.f1.d(ch.threema.client.x0) failed to verify: void ch.threema.client.f1.d(ch.threema.client.x0):
  208. # [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)
  209. #
  210. # Adding this line fixes the problem. It's most probably a bug in the R8 optimizer
  211. # that's triggered by this file, the NonceFactory wasn't modified since 2017...
  212. # Maybe we can remove this again with a future build toolchain.
  213. -keep class ch.threema.base.crypto.NonceFactory { *; }