proguard-project.txt 7.8 KB

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