Closed rwozniak closed 3 years ago
Hey @rwozniak,
could you please annotate FeedResource
class with @Keep
annotation?
Hi @rafalniski ,
unfortunately it does not help - and I already have the Proguard configuration in place to not obfuscate any of my Resource
classes:
-keep class com.my.app.data.vault.resource.** { *; }
Ok, one more try. Could you add those rules?
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
private static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
Unfortunately I have already seen that in one of the issues here, have it in the vault.pro Proguard file and I have the same error
Hi, any updates here?
Sorry for the late response. Have you annotated your model class fields with @Field? If yes, can I see your model classes? Also could you please try this tool: https://playground.proguard.com/ and see if your model classes are not affected by proguard?
Sorry for late reply also, it turns out that the culprit in here was Kotlin. A debugging session after downloading the library revealed that the problematic class was this one:
@ContentType("external")
class ExternalResource : Resource() {
@Field
lateinit var title: String
//...
}
The external
content type is crucial here as it is also a keyword in Kotlin. I have not dived deeper into the bottom of this, but changing implementation of this class from Kotlin to Java solved the issue:
@ContentType("external")
public class ExternalResource extends Resource {
@Field
public String title;
//...
}
@rwozniak Glad, you managed to resolve this, thanks!
We’re developing an app using Contentful java SDK and the Vault for caching content. Everything works fine until I turn on Proguard (
minifyEnabled true
). I’m using the proguard config file from the repo (https://github.com/contentful/vault/blob/master/proguard-vault.cfg), yet I’m getting an error when querying Vault.and the exception I’m getting:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.contentful.vault.ModelHelper.getFields()' on a null object reference
Any idea what might be causing this? I’m struggling with Proguard configuration for a few hours now without any success (I’m even keeping all the classes from my codebase as well as from Vault and it still does not work).