proguard-project.txt 7.5 KB

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