Fix proguard of lifecycle-runtime
bug: 62113696
Test: no code changes.
Change-Id: I39d41a06d759a28dffbee95d250adb3a10e0e33a
diff --git a/lifecycle/extensions/build.gradle b/lifecycle/extensions/build.gradle
index 8358f6b..35573ae 100644
--- a/lifecycle/extensions/build.gradle
+++ b/lifecycle/extensions/build.gradle
@@ -14,10 +14,14 @@
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+
+ buildTypes.all {
+ consumerProguardFiles 'proguard-rules.pro'
+ }
+
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
diff --git a/lifecycle/extensions/proguard-rules.pro b/lifecycle/extensions/proguard-rules.pro
index b7210d1..a24a5d3 100644
--- a/lifecycle/extensions/proguard-rules.pro
+++ b/lifecycle/extensions/proguard-rules.pro
@@ -1,17 +1,7 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/yboyar/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
+-keep class * extends android.arch.lifecycle.ViewModel {
+ <init>();
+}
-# 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 *;
-#}
+-keep class * extends android.arch.lifecycle.AndroidViewModel {
+ <init>(android.app.Application);
+}
\ No newline at end of file
diff --git a/lifecycle/runtime/build.gradle b/lifecycle/runtime/build.gradle
index c0dde3d..f2bf671 100644
--- a/lifecycle/runtime/build.gradle
+++ b/lifecycle/runtime/build.gradle
@@ -12,12 +12,15 @@
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
}
+
+ buildTypes.all {
+ consumerProguardFiles 'proguard-rules.pro'
+ }
+
buildTypes {
release {
minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}