Update proguard rules to differentiate between reflect or codegen

This commit is contained in:
Zac Sweers
2018-05-14 20:22:23 -07:00
committed by GitHub
parent 6e411eb243
commit defebcf8e5

View File

@@ -588,10 +588,15 @@ If you are using ProGuard you might need to add the following options:
-keep @com.squareup.moshi.JsonQualifier interface * -keep @com.squareup.moshi.JsonQualifier interface *
``` ```
Additional rules are needed if you are using Kotlin: Additional rules are needed if you are using Kotlin:
*...If you are using the reflect API (i.e. `KotlinJsonAdapter`):*
``` ```
-keepclassmembers class kotlin.Metadata { -keepclassmembers class kotlin.Metadata {
public <methods>; public <methods>;
} }
```
*...If you are using the codegen API (i.e. `JsonClass(generateAdapter = true)`):*
```
-keepnames class **JsonAdapter -keepnames class **JsonAdapter
-keepnames @com.squareup.moshi.JsonClass class * -keepnames @com.squareup.moshi.JsonClass class *
``` ```
@@ -620,4 +625,4 @@ License
[okhttp]: https://github.com/square/okhttp/ [okhttp]: https://github.com/square/okhttp/
[gson]: https://github.com/google/gson/ [gson]: https://github.com/google/gson/
[javadoc]: https://square.github.io/moshi/1.x/moshi/ [javadoc]: https://square.github.io/moshi/1.x/moshi/
[kapt]: https://kotlinlang.org/docs/reference/kapt.html [kapt]: https://kotlinlang.org/docs/reference/kapt.html