From d340d697426c765a95fa38a4f3b3f105fe541959 Mon Sep 17 00:00:00 2001 From: Ernir Erlingsson <ernir@ymirmobile.com> Date: Sun, 31 Jan 2016 23:38:34 +0100 Subject: [PATCH] added proguard and cleaned dependencies --- briar-android/build.gradle | 37 +++++++++++++++++++++---- briar-android/proguard-rules.txt | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 briar-android/proguard-rules.txt diff --git a/briar-android/build.gradle b/briar-android/build.gradle index 4ead68e29f..8430591c16 100644 --- a/briar-android/build.gradle +++ b/briar-android/build.gradle @@ -6,14 +6,29 @@ repositories { } dependencies { + def supportVersion = '23.1.1' + compile project(':briar-api') compile project(':briar-core') compile fileTree(dir: 'libs', include: '*.jar') - compile "com.android.support:support-v4:23.1.1" - compile "com.android.support:appcompat-v7:23.1.1" - compile "com.android.support:preference-v7:23.1.1" - compile "com.android.support:preference-v14:23.1.1" - compile "com.android.support:design:23.1.1" + compile fileTree(dir: 'libs', include: '*.jar') + compile "com.android.support:support-v4:$supportVersion" + compile("com.android.support:appcompat-v7:$supportVersion") { + exclude module: 'support-v4' + } + compile("com.android.support:preference-v7:$supportVersion") { + exclude module: 'support-v4' + } + compile("com.android.support:preference-v14:$supportVersion") { + exclude module: 'support-v4' + exclude module: 'preference-v7' + exclude module: 'recyclerview-v7' + } + + compile("com.android.support:design:$supportVersion") { + exclude module: 'support-v4' + exclude module: 'recyclerview-v7' + } compile "org.roboguice:roboguice:2.0" compile "info.guardianproject.panic:panic:0.5" compile "info.guardianproject.trustedintents:trustedintents:0.2" @@ -62,6 +77,18 @@ android { debug.setRoot('build-types/debug') release.setRoot('build-types/release') } + + buildTypes { + debug { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_6 targetCompatibility JavaVersion.VERSION_1_6 diff --git a/briar-android/proguard-rules.txt b/briar-android/proguard-rules.txt new file mode 100644 index 0000000000..2bdc21e2aa --- /dev/null +++ b/briar-android/proguard-rules.txt @@ -0,0 +1,47 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-verbose +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* +-ignorewarnings +-renamesourcefileattribute SourceFile +-keepattributes SourceFile,LineNumberTable,*Annotation*,Signature + +-keep public class * extends android.app.Activity +-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 com.android.vending.licensing.ILicensingService +-keepclasseswithmembers 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 * implements android.os.Parcelable { static android.os.Parcelable$Creator *; } +-keepclassmembers class **.R$* { public static <fields>; } +-keepclasseswithmembernames class * { native <methods>; } +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} +-keepclassmembers class * { + @com.google.inject.Inject <init>(...); + @com.google.inject.Inject <fields>; +} +# Just in case Roboguice events are used +-keepclassmembers class * { + void *(**On*Event); +} + +-keep class org.briarproject.** { *; } +-keep class com.google.inject.** { *; } +-keep class javax.inject.** { *; } +-keep class javax.annotation.** { *; } +-keep class roboguice.** { *; } \ No newline at end of file -- GitLab