proguard-project.txt 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 sun.reflect.**
  88. -dontwarn android.test.**
  89. -dontwarn class.org.junit.**
  90. -dontwarn android.app.**
  91. -dontwarn android.support.**
  92. -dontwarn android.view.**
  93. -dontwarn android.widget.**
  94. -dontwarn com.google.common.primitives.**
  95. -dontwarn java.beans.**
  96. # WebRTC fails to build due to missing dependencies
  97. # "Warning: org.webrtc.SoftwareVideoDecoderFactory: can't find referenced class org.webrtc.LibvpxVp8Decoder"
  98. -dontwarn org.webrtc.**
  99. # hms requirements
  100. -ignorewarnings
  101. -keep class com.huawei.updatesdk.**{*;}
  102. -keep class com.huawei.hms.**{*;}
  103. -keep class com.huawei.android.sdk.drm.**{*;}
  104. # remove android log calls below error
  105. -assumenosideeffects class android.util.Log {
  106. public static *** v(...);
  107. public static *** d(...);
  108. public static *** i(...);
  109. public static *** w(...);
  110. }
  111. # remaining options from proguard-android-optimize.txt
  112. -renamesourcefileattribute SourceFile
  113. -keep public class com.google.android.vending.licensing.ILicensingService
  114. # keep setters in Views so that animations can still work.
  115. # see http://proguard.sourceforge.net/manual/examples.html#beans
  116. -keepclassmembers public class * extends android.view.View {
  117. void set*(***);
  118. *** get*();
  119. }
  120. -keepnames class com.fasterxml.jackson.** { *; }
  121. -keepnames interface com.fasterxml.jackson.** { *; }
  122. -keep class org.codehaus.** { *; }
  123. -dontwarn org.w3c.dom.**
  124. -dontwarn de.tavendo.autobahn.**
  125. -dontwarn com.fasterxml.jackson.databind.ext.PathDeserializer**
  126. # Msgpack
  127. -keep class org.msgpack.core.** { *; }
  128. -keep class org.msgpack.value.** { *; }
  129. # SLF4J
  130. -keep class org.slf4j.**
  131. -dontwarn org.slf4j.impl.StaticMDCBinder
  132. -dontwarn org.slf4j.impl.StaticMarkerBinder
  133. -dontwarn org.slf4j.impl.StaticLoggerBinder
  134. # WebRTC
  135. -keep class org.webrtc.** { *; }
  136. # Messages are serialized using reflection
  137. -keep class ch.threema.app.webclient.messages.** { *; }
  138. # Keep our own searchview visible
  139. -keep public class * extends androidx.appcompat.widget.SearchView {*;}
  140. # https://stackoverflow.com/questions/44145786/thousands-of-strange-crashes-in-new-google-play-console-version
  141. -keep class * extends android.app.Application {*;}
  142. # from https://github.com/ohmae/preference-activity-compat
  143. -keep public class * extends androidx.preference.PreferenceFragmentCompat
  144. # https://stackoverflow.com/questions/51006967/androidx-build-fails-in-release-mode-regarding-appcomponentfactory
  145. -keep class androidx.core.app.CoreComponentFactory { *; }
  146. # Firebase analytics removal
  147. -dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
  148. # keep camera classes - 1.0.0-alpha03 causes VerifyError in Android 4.4
  149. -keep class androidx.camera.** { *; }
  150. # protobuf uses reflection
  151. -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
  152. <fields>;
  153. }
  154. # glide image loading
  155. -keep public class * implements com.bumptech.glide.module.GlideModule
  156. -keep class * extends com.bumptech.glide.module.AppGlideModule {
  157. <init>(...);
  158. }
  159. -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  160. **[] $VALUES;
  161. public *;
  162. }
  163. -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  164. *** rewind();
  165. }
  166. # For reasons unknown to us, starting with the 4.5 release branch, a release build
  167. # would throw an exception on app start:
  168. #
  169. # java.lang.VerifyError: Verifier rejected class ch.threema.client.f1:
  170. # void ch.threema.client.f1.d(ch.threema.client.x0) failed to verify: void ch.threema.client.f1.d(ch.threema.client.x0):
  171. # [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)
  172. #
  173. # Adding this line fixes the problem. It's most probably a bug in the R8 optimizer
  174. # that's triggered by this file, the NonceFactory wasn't modified since 2017...
  175. # Maybe we can remove this again with a future build toolchain.
  176. -keep class ch.threema.base.crypto.NonceFactory { *; }
  177. -dontwarn build.IgnoreJava8API
  178. -dontwarn sun.security.x509.X509Key
  179. # https://issuetracker.google.com/issues/159595260
  180. -keep class * extends androidx.startup.Initializer {
  181. <init>();
  182. }
  183. -keep class java8.util.ImmutableCollections { *; }
  184. # https://stackoverflow.com/questions/73748946/proguard-r8-warnings
  185. -dontwarn org.conscrypt.**
  186. -dontwarn org.bouncycastle.**
  187. -dontwarn org.openjsse.**