proguard-project.txt 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. # remove android log calls below error
  119. -assumenosideeffects class android.util.Log {
  120. public static *** v(...);
  121. public static *** d(...);
  122. public static *** i(...);
  123. public static *** w(...);
  124. }
  125. # remaining options from proguard-android-optimize.txt
  126. -renamesourcefileattribute SourceFile
  127. -keepattributes *Annotation*,SourceFile,LineNumberTable
  128. -keep public class com.google.android.vending.licensing.ILicensingService
  129. # keep setters in Views so that animations can still work.
  130. # see http://proguard.sourceforge.net/manual/examples.html#beans
  131. -keepclassmembers public class * extends android.view.View {
  132. void set*(***);
  133. *** get*();
  134. }
  135. # Jackson
  136. -keepattributes Signature,*Annotation*,EnclosingMethod
  137. -keep class com.fasterxml.jackson.databind.ObjectMapper {
  138. public <methods>;
  139. protected <methods>;
  140. }
  141. -keep class com.fasterxml.jackson.databind.ObjectWriter {
  142. public ** writeValueAsString(**);
  143. }
  144. -keepnames class com.fasterxml.jackson.** { *; }
  145. -keepnames interface com.fasterxml.jackson.** { *; }
  146. -keep class org.codehaus.** { *; }
  147. -dontwarn org.w3c.dom.**
  148. -dontwarn de.tavendo.autobahn.**
  149. -dontwarn com.fasterxml.jackson.databind.ext.PathDeserializer**
  150. # Msgpack
  151. -keep class org.msgpack.core.** { *; }
  152. -keep class org.msgpack.value.** { *; }
  153. # SLF4J
  154. -keep class org.slf4j.**
  155. -dontwarn org.slf4j.impl.StaticMDCBinder
  156. -dontwarn org.slf4j.impl.StaticMarkerBinder
  157. -dontwarn org.slf4j.impl.StaticLoggerBinder
  158. -keepattributes *Annotation*
  159. # WebRTC
  160. -keep class org.webrtc.** { *; }
  161. # Messages are serialized using reflection
  162. -keep class ch.threema.app.webclient.messages.** { *; }
  163. # Keep our own searchview visible
  164. -keep public class * extends androidx.appcompat.widget.SearchView {*;}
  165. # https://stackoverflow.com/questions/44145786/thousands-of-strange-crashes-in-new-google-play-console-version
  166. -keep class * extends android.app.Application {*;}
  167. # from https://github.com/ohmae/preference-activity-compat
  168. -keep public class * extends androidx.preference.PreferenceFragmentCompat
  169. # https://stackoverflow.com/questions/51006967/androidx-build-fails-in-release-mode-regarding-appcomponentfactory
  170. -keep class androidx.core.app.CoreComponentFactory { *; }
  171. # Firebase analytics removal
  172. -dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
  173. # keep camera classes - 1.0.0-alpha03 causes VerifyError in Android 4.4
  174. -keep class androidx.camera.** { *; }
  175. # respect DoNotOptimize annotations in soloader used by mapbox - causes VerifyError in Android 4.4
  176. -keep,allowobfuscation @interface com.facebook.soloader.DoNotOptimize
  177. -keep @com.facebook.soloader.DoNotOptimize class *
  178. -keepclassmembers class * {
  179. @com.facebook.soloader.DoNotOptimize *;
  180. }
  181. # protobuf uses reflection
  182. -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  183. <fields>;
  184. }
  185. # glide image loading
  186. -keep public class * implements com.bumptech.glide.module.GlideModule
  187. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  188. <init>(...);
  189. }
  190. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  191. **[] $VALUES;
  192. public *;
  193. }
  194. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  195. *** rewind();
  196. }
  197. # For reasons unknown to us, starting with the 4.5 release branch, a release build
  198. # would throw an exception on app start:
  199. #
  200. # java.lang.VerifyError: Verifier rejected class ch.threema.client.f1:
  201. # void ch.threema.client.f1.d(ch.threema.client.x0) failed to verify: void ch.threema.client.f1.d(ch.threema.client.x0):
  202. # [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)
  203. #
  204. # Adding this line fixes the problem. It's most probably a bug in the R8 optimizer
  205. # that's triggered by this file, the NonceFactory wasn't modified since 2017...
  206. # Maybe we can remove this again with a future build toolchain.
  207. -keep class ch.threema.client.NonceFactory { *; }