[Android] [PATCH] Minify app and repackage support libs

Geoffrey Métais geoffrey.metais at gmail.com
Mon Dec 22 15:08:17 CET 2014


This will be needed to avoid crash on samsung devices
---
 vlc-android/build.gradle |  3 +++
 vlc-android/proguard.cfg | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 6b0869a..2be3dd0 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -72,6 +72,9 @@ android {
         release {
             signingConfig signingConfigs.release
             tasks.assembleRelease.dependsOn buildRelease
+            minifyEnabled true
+            shrinkResources true
+            proguardFile 'proguard.cfg'
         }
         debug {
             tasks.assembleDebug.dependsOn buildDebug
diff --git a/vlc-android/proguard.cfg b/vlc-android/proguard.cfg
index b1cdf17..332b17d 100644
--- a/vlc-android/proguard.cfg
+++ b/vlc-android/proguard.cfg
@@ -1,9 +1,13 @@
 -optimizationpasses 5
 -dontusemixedcaseclassnames
 -dontskipnonpubliclibraryclasses
+-dontobfuscate
 -dontpreverify
 -verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
+
+# Do not optimize/shrink LibVLC, because of native code
+-keep class org.videolan.libvlc.** { *; }
 
 -keep public class * extends android.app.Activity
 -keep public class * extends android.app.Application
@@ -14,6 +18,11 @@
 -keep public class * extends android.preference.Preference
 -keep public class com.android.vending.licensing.ILicensingService
 
+# Samsung shit workaround
+-repackageclasses "android.support.v7"
+-keep class android.support.v7.widget.** { *; }
+-keep interface android.support.v7.widget.** { *; }
+
 -keepclasseswithmembernames class * {
     native <methods>;
 }
-- 
1.9.1



More information about the Android mailing list