From cf2225df77ab71f654a96b96a3dd2c479a056157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Sat, 21 Nov 2015 20:54:14 -0500 Subject: [PATCH] proguard: fix release build Prevents obfuscation of some symbols to fix release builds by adding a custom proguard configuration, based on Android optimised defaults. * protect AIDL and SWIG symbols * protect support library (uses reflexion) * protect OrmLite (uses reflexion) Tuleap: #128 Change-Id: Ie1fe8fa6af1a6968ca0889f8fe343e58a35071b6 --- ring-android/app/build.gradle | 1 + ring-android/app/proguard-project.txt | 20 -------------------- ring-android/app/proguard-rules.pro | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 20 deletions(-) delete mode 100644 ring-android/app/proguard-project.txt create mode 100644 ring-android/app/proguard-rules.pro diff --git a/ring-android/app/build.gradle b/ring-android/app/build.gradle index 58e38dec0..dc6e374d9 100644 --- a/ring-android/app/build.gradle +++ b/ring-android/app/build.gradle @@ -43,6 +43,7 @@ android { buildTypes { release { minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } signingConfigs { diff --git a/ring-android/app/proguard-project.txt b/ring-android/app/proguard-project.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/ring-android/app/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# 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 *; -#} diff --git a/ring-android/app/proguard-rules.pro b/ring-android/app/proguard-rules.pro new file mode 100644 index 000000000..a29d5f0bc --- /dev/null +++ b/ring-android/app/proguard-rules.pro @@ -0,0 +1,25 @@ +-keepclassmembers class * { + public <init>(android.content.Context); +} + +-keep class cx.ring.service.** +-keepclassmembers class cx.ring.service.** { *; } + +#OrmLite uses reflection +-keep class com.j256.** +-keepclassmembers class com.j256.** { *; } +-keep enum com.j256.** +-keepclassmembers enum com.j256.** { *; } +-keep interface com.j256.** +-keepclassmembers interface com.j256.** { *; } + +# Keep the helper class and its constructor +-keep class * extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper + +# Keep all model classes that are used by OrmLite +# Also keep their field names and the constructor +-keep @com.j256.ormlite.table.DatabaseTable class * { + @com.j256.ormlite.field.DatabaseField <fields>; + @com.j256.ormlite.field.ForeignCollectionField <fields>; + <init>(); +} -- GitLab