Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
wk...@google.com <wk...@google.com> #2
Also we need to add following for activities and fragments using VIewModel with to start:
## Android architecture components: ViewModel
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
<init>(...);
}
## Android architecture components: ViewModel
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
<init>(...);
}
wk...@google.com <wk...@google.com>
wk...@google.com <wk...@google.com>
ce...@gmail.com <ce...@gmail.com> #3
Update:
Managed to gethttps://github.com/googlesamples/android-architecture-components/tree/master/BasicSample working with the following set of rules:
## Android architecture components: Lifecycle
# generated GenericLifecycleObserver and it's empty constructor is considered to be unused by proguard
-keepclasseswithmembers class * implements android.arch.lifecycle.GenericLifecycleObserver {
<init>(...);
}
# keep Lifecycle State and Event enums with fields
-keepclassmembers class android.arch.lifecycle.Lifecycle$* { *; }
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
-keepclassmembers class * {
@android.arch.lifecycle.OnLifecycleEvent *;
}
# ViewModel's empty constructor is considered to be unused by proguard
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
<init>(...);
}
Not quite sure if it's the final version (I think we can prettify it a bit), but everything seems to work fine.
Managed to get
## Android architecture components: Lifecycle
# generated GenericLifecycleObserver and it's empty constructor is considered to be unused by proguard
-keepclasseswithmembers class * implements android.arch.lifecycle.GenericLifecycleObserver {
<init>(...);
}
# keep Lifecycle State and Event enums with fields
-keepclassmembers class android.arch.lifecycle.Lifecycle$* { *; }
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
-keepclassmembers class * {
@android.arch.lifecycle.OnLifecycleEvent *;
}
# ViewModel's empty constructor is considered to be unused by proguard
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
<init>(...);
}
Not quite sure if it's the final version (I think we can prettify it a bit), but everything seems to work fine.
Description
Version used: 1.0.0-alpha01
Minimal project that demonstrates issue:
Using Android Studio 3.2 Canary 15, I use the new project wizard to create an empty project and then to add an Android Library module.
When adding this line:
apply plugin: "androidx.navigation.safeargs"
to the library module's build.gradle, I get this error:
Caused by: org.gradle.api.GradleException: safeargs plugin must be used with android plugin
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:36)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:32)
However, I don't get any errors when adding the same line to the app's build.gradle file.