Skip to content

Instantly share code, notes, and snippets.

@talenguyen
Last active November 22, 2018 04:57
Show Gist options
  • Save talenguyen/bba683bf467eab421095b6d094d6542e to your computer and use it in GitHub Desktop.
Save talenguyen/bba683bf467eab421095b6d094d6542e to your computer and use it in GitHub Desktop.
Logging of my Android Development

Multidex Note

Make sure you call MultiDex.install(this); after super.attachBaseContext(base);. Because it will not work in revert order.

@Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }

Proguard for MvRx & Kotlin


# Kotlin

-dontwarn org.jetbrains.annotations.**
-keep class kotlin.Metadata { *; }

# Kotlin Reflect internal impl
-keep public class kotlin.reflect.jvm.internal.impl.builtins.* { public *; }
#-keep public class kotlin.reflect.jvm.internal.impl.load.* { public *; }
-keep class kotlin.reflect.jvm.internal.impl.load.**
#-keep public class kotlin.reflect.jvm.internal.impl.load.java.FieldOverridabilityCondition
#-keep public class kotlin.reflect.jvm.internal.impl.load.java.ErasedOverridabilityCondition

# BaseMvRxViewModels loads the Companion class via reflection and thus we need to make sure we keep
# the name of the Companion object.
-keepclassmembers class ** extends com.airbnb.mvrx.BaseMvRxViewModel {
    ** Companion;
}

# Classes extending BaseMvRxViewModel are recreated using reflection, which assumes that a one argument
# constructor accepting a data class holding the state exists. Need to make sure to keep the constructor
# around. Additionally, a static create method will be generated in the case a companion object factory
# is used. This is accessed via reflection.
-keepclassmembers class ** extends com.airbnb.mvrx.BaseMvRxViewModel {
    public <init>(...);
    public static *** create(...);
}

# Need to keep class name due to kotlin-reflect
-keep interface com.airbnb.mvrx.MvRxState
# !! Tweak this once https://issuetracker.google.com/issues/112386012 is fixed !!
# Need to keep class name due to kotlin-reflect
-keep class * implements com.airbnb.mvrx.MvRxState { *; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment