Problems with classes that implements java.io.Serializable

I want to obfuscate a part of a project, so I have separated the project into two parts.

In the part I want to obfuscate I have different classes that have a Serializable implements and normal java classes.

On my build.gradle I had the following task:

task myProguardTask(type: ProGuardTask){

injars '/build/libs/Library-files-0.0.1-SNAPSHOT.jar'
outjars '/build/libs/Library-files-outJAR.jar'

libraryjars "${System.getProperty('java.home')}/lib/rt.jar"

adaptresourcefilenames '**.properties'
adaptresourcefilecontents '**.properties,META-INF/MANIFEST.MF'
allowaccessmodification()

keepnames 'class * implements java.io.Serializable'

keepclassmembers 'class * implements java.io.Serializable { \
    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(); \
}'

adaptclassstrings('com.example.test.xxx.**')

}

(Adaptclassstring is the package of the project and I use ** because I have Serializable implements on 2 different packages.)

However, when I run the task I get this error:

  • Type ‘proguard.gradle.ProGuardTask’ property ‘adaptclassstrings’ is missing an input or output annotation.
  • Type ‘proguard.gradle.ProGuardTask’ property ‘adaptresourcefilecontents’ is missing an input or output annotation.
  • Type ‘proguard.gradle.ProGuardTask’ property ‘adaptresourcefilenames’ is missing an input or output annotation.
  • Type ‘proguard.gradle.ProGuardTask’ property ‘addconfigurationdebugging’ is missing an input or output annotation.
  • Type ‘proguard.gradle.ProGuardTask’ property ‘allowaccessmodification’ is missing an input or output annotation.

Am I missing something or am I creating the task wrong?

Thank you!

Hi @Leicht,

Thanks for reaching out and welcome to the Guardsquare Community!

After speaking with some of our Engineers, upgrading to ProGuard 7.1 should do the trick. Please let us know after, if you’re still having issues, and we’ll help troubleshoot.

Have a great rest of your day,
Jesse

1 Like

Hi @Jesse!,

I think it worked! Thanks!

1 Like

Fantastic! Let us know if you need anything else.

1 Like