[Android] Move R8 rules to app module

Geoffrey Métais git at videolan.org
Mon May 4 16:39:51 CEST 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May  4 10:24:25 2020 +0200| [cd93c94cbff66c7d975709b8bb357686290bda42] | committer: Nicolas Pomepuy

Move R8 rules to app module

> https://code.videolan.org/videolan/vlc-android/commit/cd93c94cbff66c7d975709b8bb357686290bda42
---

 application/app/proguard-rules.pro   | 108 ++++++++++++++++++++++++++++++++---
 application/vlc-android/proguard.cfg | 100 --------------------------------
 2 files changed, 100 insertions(+), 108 deletions(-)

diff --git a/application/app/proguard-rules.pro b/application/app/proguard-rules.pro
index f1b424510..33970e182 100644
--- a/application/app/proguard-rules.pro
+++ b/application/app/proguard-rules.pro
@@ -5,17 +5,109 @@
 # For more details, see
 #   http://developer.android.com/guide/developing/tools/proguard.html
 
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
-
 # Uncomment this to preserve the line number information for
 # debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
+-keepattributes SourceFile,LineNumberTable
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
 #-renamesourcefileattribute SourceFile
+
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-dontwarn **
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
+
+# Do not optimize/shrink LibVLC, because of native code
+-keep class org.videolan.libvlc.** { *; }
+# Same for MediaLibrary
+-keep class org.videolan.medialibrary.** { *; }
+
+-keep public class * extends android.app.Activity {
+    public <methods>;
+}
+-keep public class * extends android.app.Fragment {
+    public <methods>;
+}
+-keep public class * extends androidx.fragment.app.Fragment {
+    public <methods>;
+}
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
+
+# support design
+-dontwarn android.support.design.**
+-keep class android.support.design.** { *; }
+-keep interface android.support.design.** { *; }
+-keep public class android.support.design.R$* { *; }
+
+-dontwarn android.support.**
+
+# Kotlinx
+-keep class kotlinx.coroutines.internal.MainDispatcherFactory { *; }
+-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler { *; }
+-keep class kotlinx.coroutines.CoroutineExceptionHandler { *; }
+-keep class kotlinx.coroutines.android.AndroidDispatcherFactory { *; }
+-keep class kotlin.Result { *; }
+-keepclassmembernames class kotlinx.** {
+    volatile <fields>;
+}
+# Retrofit
+# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
+# EnclosingMethod is required to use InnerClasses.
+-keepattributes Signature, InnerClasses, EnclosingMethod
+
+# Retrofit does reflection on method and parameter annotations.
+-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
+
+# Retain service method parameters when optimizing.
+-keepclassmembers,allowshrinking,allowobfuscation interface * {
+    @retrofit2.http.* <methods>;
+}
+
+# Ignore annotation used for build tooling.
+-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
+
+# Ignore JSR 305 annotations for embedding nullability information.
+-dontwarn javax.annotation.**
+
+# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
+-dontwarn kotlin.Unit
+
+# Top-level functions that can only be used by Kotlin.
+-dontwarn retrofit2.-KotlinExtensions
+
+-keep class com.google.android.material.** { *; }
diff --git a/application/vlc-android/proguard.cfg b/application/vlc-android/proguard.cfg
deleted file mode 100644
index fabb48950..000000000
--- a/application/vlc-android/proguard.cfg
+++ /dev/null
@@ -1,100 +0,0 @@
--optimizationpasses 5
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontobfuscate
--dontpreverify
--dontwarn **
--verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
--keepattributes SourceFile,LineNumberTable
-
-# Do not optimize/shrink LibVLC, because of native code
--keep class org.videolan.libvlc.** { *; }
-# Same for MediaLibrary
--keep class org.videolan.medialibrary.** { *; }
-
--keep public class * extends android.app.Activity {
-    public <methods>;
-}
--keep public class * extends android.app.Fragment {
-    public <methods>;
-}
--keep public class * extends androidx.fragment.app.Fragment {
-    public <methods>;
-}
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class * extends android.app.backup.BackupAgentHelper
--keep public class * extends android.preference.Preference
--keep public class com.android.vending.licensing.ILicensingService
-
--keepclasseswithmembernames class * {
-    native <methods>;
-}
-
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers class * extends android.app.Activity {
-   public void *(android.view.View);
-}
-
--keepclassmembers enum * {
-    public static **[] values();
-    public static ** valueOf(java.lang.String);
-}
-
--keep class * implements android.os.Parcelable {
-  public static final android.os.Parcelable$Creator *;
-}
-
-# support design
--dontwarn android.support.design.**
--keep class android.support.design.** { *; }
--keep interface android.support.design.** { *; }
--keep public class android.support.design.R$* { *; }
-
--dontwarn android.support.**
-
-# Kotlinx
--keep class kotlinx.coroutines.internal.MainDispatcherFactory { *; }
--keep class kotlinx.coroutines.android.AndroidExceptionPreHandler { *; }
--keep class kotlinx.coroutines.CoroutineExceptionHandler { *; }
--keep class kotlinx.coroutines.android.AndroidDispatcherFactory { *; }
--keep class kotlin.Result { *; }
--keepclassmembernames class kotlinx.** {
-    volatile <fields>;
-}
-# Retrofit
-# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
-# EnclosingMethod is required to use InnerClasses.
--keepattributes Signature, InnerClasses, EnclosingMethod
-
-# Retrofit does reflection on method and parameter annotations.
--keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-
-# Retain service method parameters when optimizing.
--keepclassmembers,allowshrinking,allowobfuscation interface * {
-    @retrofit2.http.* <methods>;
-}
-
-# Ignore annotation used for build tooling.
--dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-
-# Ignore JSR 305 annotations for embedding nullability information.
--dontwarn javax.annotation.**
-
-# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
--dontwarn kotlin.Unit
-
-# Top-level functions that can only be used by Kotlin.
--dontwarn retrofit2.-KotlinExtensions
-
--keep class com.google.android.material.** { *; }



More information about the Android mailing list