diff --git a/app/build.gradle b/app/build.gradle index c040bc3..3262768 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,9 +10,15 @@ android { targetSdkVersion 22 versionCode 14 versionName "2.0.0" + setProperty("archivesBaseName", "AffdexMe-$versionName-$versionCode") } buildTypes { + debug { + resValue 'string', 'app_name', 'AffdexMeDbg' + applicationIdSuffix ".debug" + } release { + resValue 'string', 'app_name', 'AffdexMe' minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } @@ -42,3 +48,18 @@ dependencies { //compile 'com.google.android.gms:play-services:7.5.0' } + +// build a signed release apk only if the environment is configured +// with the properties that let us access the keystore. you can put +// them into ~/.gradle/gradle.properties +if (project.hasProperty('releaseKeystoreFile')) { + android.signingConfigs { + release { + storeFile file(releaseKeystoreFile) + storePassword releaseKeystorePassword + keyAlias releaseKeyAlias + keyPassword releaseKeyPassword + } + } + android.buildTypes.release.signingConfig = android.signingConfigs.release +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index c32d4ca..fb45170 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,16 +1,58 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/AlanCasalas/Library/Android/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html -# Add any project specific keep options here: +-dontskipnonpubliclibraryclasses -#prevent proguard from warning us about not including the GooglePlay dependency --dontwarn ** +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +-dontoptimize +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** #keep all classes (otherwise Proguard may remove classes that use reflection, injection, Gson, etc...) -keep class sun.** @@ -22,22 +64,22 @@ -keep class javax.** -keepclassmembers class javax.** {*;} - #keep certain class members (otherwise Proguard would strip the members of these classes) -keep class com.** --keepclassmembers class com.affectiva.android.affdex.sdk.detector.A* { *; } --keepclassmembers class com.affectiva.android.affdex.sdk.detector.B* { *; } --keepclassmembers class com.affectiva.android.affdex.sdk.detector.I* { *; } --keepclassmembers class com.affectiva.android.affdex.sdk.detector.L* { *; } --keepclassmembers class com.affectiva.android.affdex.sdk.Frame { *; } +-keepclassmembers class !com.affectiva.affdexme.MainActivity,!com.affectiva.android.affdex.sdk.detector.Detector {*;} +-keepclassmembers class com.affectiva.android.affdex.sdk.detector.Detector { + public void setDetect**; +} - --keepclassmembers class com.affectiva.affdexme.DrawingView {*;} --keepclassmembers class com.affectiva.affdexme.MetricView {*;} --keepclassmembers class com.affectiva.affdexme.GradientMetricView {*;} - --keepclassmembers class * { - @javax.inject.* *; - @dagger.* *; - (); -} \ No newline at end of file +# Dagger +-dontwarn dagger.internal.codegen.** +-keepclassmembers,allowobfuscation class * { + @javax.inject.* *; + @dagger.* *; + (); +} +-keep class dagger.* { *; } +-keep class javax.inject.* { *; } +-keep class * extends dagger.internal.Binding +-keep class * extends dagger.internal.ModuleAdapter +-keep class * extends dagger.internal.StaticInjection diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f755dd3..20a5b8e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,4 @@ - AffdexMe - Sorry, AffdexMe requires the use of a front-facing camera, which was not found on your device. Affectiva Logo