mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
Update Proguard configuration for codegen (#542)
* Update Proguard configuration for codegen -keepnames will prevent Proguard from renaming the class during obfuscation phase but won't protect the class from code shrinking. In most cases, the generated are never referenced directly in the code as the adapters are loaded dynamically. This means that, for Proguard, the class is unused and it will remove the generated adapters during the shrinking phase. The adapters need to be kept as well as there primary constructor. * Keep fields of generated JsonAdapter
This commit is contained in:
committed by
Jesse Wilson
parent
16938ab83a
commit
b5a50d8281
@@ -597,7 +597,10 @@ Additional rules are needed if you are using Kotlin:
|
||||
```
|
||||
*...If you are using the codegen API (i.e. `JsonClass(generateAdapter = true)`):*
|
||||
```
|
||||
-keepnames class **JsonAdapter
|
||||
-keep class **JsonAdapter {
|
||||
<init>(...);
|
||||
<fields>;
|
||||
}
|
||||
-keepnames @com.squareup.moshi.JsonClass class *
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user