[Android] Minify app and repackage support libs

Geoffrey Métais git at videolan.org
Mon Dec 22 15:21:00 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 22 15:07:31 2014 +0100| [019f56c21e4fbc8a5deaab37d466f2d47b565d50] | committer: Geoffrey Métais

Minify app and repackage support libs

This will be needed to avoid crash on samsung devices

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=019f56c21e4fbc8a5deaab37d466f2d47b565d50
---

 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>;
 }



More information about the Android mailing list