From a413346610848651db7184b9b3025295bbdf210e Mon Sep 17 00:00:00 2001 From: Rhodey Orbits Date: Tue, 7 Apr 2015 17:36:00 -0700 Subject: [PATCH] Fix the connectedCheck build target 1) Create a new build type for testing. 2) Only obfuscate the package android.support.v7.internal.view.menu to prevent LGE ROM bug 3) '-keepattributes Exceptions' to allow for throwing from mocks 4) -dontskipnonpubliclibraryclassmembers and -dontwarn for everything else Fixes #2871 Closes #2986 // FREEBIE --- build.gradle | 5 +++++ proguard-appcompat-v7.pro | 7 ++++--- proguard-testing.pro | 10 ++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 proguard-testing.pro diff --git a/build.gradle b/build.gradle index 765f1a4222..2bd51cfb9c 100644 --- a/build.gradle +++ b/build.gradle @@ -127,6 +127,7 @@ dependencyVerification { android { compileSdkVersion 22 buildToolsVersion '22.0.1' + testBuildType "testing" dexOptions { javaMaxHeapSize "4g" @@ -188,6 +189,10 @@ android { 'proguard.cfg' signingConfig signingConfigs.release } + testing.initWith(buildTypes.debug) + testing { + proguardFile 'proguard-testing.pro' + } } sourceSets { diff --git a/proguard-appcompat-v7.pro b/proguard-appcompat-v7.pro index 4d1f32881c..718eb9da93 100644 --- a/proguard-appcompat-v7.pro +++ b/proguard-appcompat-v7.pro @@ -1,8 +1,9 @@ +# https://code.google.com/p/android/issues/detail?id=78377 +-keepnames class !android.support.v7.internal.view.menu.**, ** { *; } + -keep public class android.support.v7.widget.** { *; } -keep public class android.support.v7.internal.widget.** { *; } -# below line disabled due to LGE ROM bug. -# -keep public class android.support.v7.internal.view.menu.** { *; } -keep public class * extends android.support.v4.view.ActionProvider { public (android.content.Context); -} \ No newline at end of file +} diff --git a/proguard-testing.pro b/proguard-testing.pro new file mode 100644 index 0000000000..affdfd8b0e --- /dev/null +++ b/proguard-testing.pro @@ -0,0 +1,10 @@ +-keepattributes Exceptions +-dontskipnonpubliclibraryclassmembers + +-dontwarn android.test.** +-dontwarn com.android.support.test.** +-dontwarn sun.reflect.** +-dontwarn org.assertj.** +-dontwarn org.hamcrest.** +-dontwarn org.mockito.** +-dontwarn com.squareup.**