Hi, I’m trying to run proguard on kryo-4.0.1.jar.
Here is the script I’m using:
wget https://repo1.maven.org/maven2/com/esotericsoftware/kryo/4.0.1/kryo-4.0.1.jar 1>/dev/null 2>/dev/null
echo "-injars kryo-4.0.1.jar" > config.pro
echo "-outjars output.jar" >> config.pro
echo "-keep class * { *; } " >> config.pro
echo "-allowaccessmodification" >> config.pro
java -jar ../proguard/lib/proguard.jar -dontwarn @config.pro
I’m mostly interested in optimization (minification is optional for me).
I’m trying to have the minimal config.pro that will contain the optimizations
listed here: lynket-browser/proguard-rules.pro at 2.1.3 · arunkumar9t2/lynket-browser · GitHub.
Problem: proguard fails:
Unexpected error while performing partial evaluation:
Class = [com/esotericsoftware/kryo/Kryo]
Method = [writeClass(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Registration;]
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes))
Unexpected error while preverifying:
Class = [com/esotericsoftware/kryo/Kryo]
Method = [writeClass(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Registration;]
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes))
Error: Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes)
Hi,
It seems there are some classes missing form the input which you will need to add by using -injars
or -libraryjars
. The warnings in the build log might provide additional information on the missing input, can you please share the full build log?
This issue along with information on how to tackle it, is documented in the ProGuard manual under “Warning: can’t find superclass or interface Warning: can’t find referenced class”, here: https://www.guardsquare.com/manual/troubleshooting/troubleshooting
Kind regards,
Jonas
Entire log:
ProGuard, version 7.1.0-beta2
Note: com.esotericsoftware.kryo.Kryo calls 'Class.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.FieldSerializer calls 'Field.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerAnnotationsUtil calls 'Field.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.TaggedFieldSerializer calls 'Field.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.TaggedFieldSerializer$1 calls 'Field.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.VersionFieldSerializer calls 'Field.getAnnotation'
Note: com.esotericsoftware.kryo.serializers.FieldSerializer calls 'Class.getTypeParameters'
Note: com.esotericsoftware.kryo.serializers.FieldSerializer calls 'Field.getType'
Note: com.esotericsoftware.kryo.serializers.FieldSerializer calls 'Field.getGenericType'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerAnnotationsUtil calls 'Field.getType'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerGenericsUtil calls 'Class.getTypeParameters'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerGenericsUtil calls 'Class.getGenericSuperclass'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerUnsafeUtilImpl calls 'Field.getType'
Note: com.esotericsoftware.kryo.Kryo calls 'Class.getEnclosingClass'
Note: com.esotericsoftware.kryo.Kryo$DefaultInstantiatorStrategy calls 'Class.getEnclosingClass'
Note: com.esotericsoftware.kryo.factories.ReflectionSerializerFactory accesses a constructor '<init>(com.esotericsoftware.kryo.Kryo,java.lang.Class)' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.serializers.BeanSerializer { BeanSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer { CompatibleFieldSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer { DefaultArraySerializers$ObjectArraySerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.EnumNameSerializer { EnumNameSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.FieldSerializer { FieldSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.TaggedFieldSerializer { TaggedFieldSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.VersionFieldSerializer { VersionFieldSerializer(com.esotericsoftware.kryo.Kryo,java.lang.Class); }'
Note: com.esotericsoftware.kryo.factories.ReflectionSerializerFactory accesses a constructor '<init>(com.esotericsoftware.kryo.Kryo)' dynamically
Note: com.esotericsoftware.kryo.factories.ReflectionSerializerFactory accesses a constructor '<init>(java.lang.Class)' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.factories.ReflectionSerializerFactory { ReflectionSerializerFactory(java.lang.Class); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.DefaultSerializers$EnumSerializer { DefaultSerializers$EnumSerializer(java.lang.Class); }'
Note: com.esotericsoftware.kryo.serializers.ClosureSerializer accesses a declared method 'writeReplace()' dynamically
Note: com.esotericsoftware.kryo.serializers.ClosureSerializer accesses a declared method 'writeReplace()' dynamically
Note: com.esotericsoftware.kryo.serializers.ClosureSerializer accesses a declared method 'readResolve()' dynamically
Note: com.esotericsoftware.kryo.serializers.DefaultSerializers$BigDecimalSerializer accesses a constructor '<init>(java.math.BigInteger,int)' dynamically
Note: com.esotericsoftware.kryo.serializers.DefaultSerializers$BigIntegerSerializer accesses a constructor '<init>(byte[])' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.io.ByteBufferInput { ByteBufferInput(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.FastInput { FastInput(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.FastOutput { FastOutput(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.Input { Input(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.Output { Output(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.UnsafeInput { UnsafeInput(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.UnsafeMemoryInput { UnsafeMemoryInput(byte[]); }'
Maybe this is program method 'com.esotericsoftware.kryo.io.UnsafeOutput { UnsafeOutput(byte[]); }'
Note: com.esotericsoftware.kryo.serializers.DefaultSerializers$DateSerializer accesses a constructor '<init>(long)' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.serializers.UnsafeCacheFields$UnsafeCachedField { UnsafeCacheFields$UnsafeCachedField(long); }'
Note: com.esotericsoftware.kryo.serializers.DefaultSerializers$TreeMapSerializer accesses a constructor '<init>(java.util.Comparator)' dynamically
Note: com.esotericsoftware.kryo.serializers.DefaultSerializers$TreeSetSerializer accesses a constructor '<init>(java.util.Comparator)' dynamically
Note: com.esotericsoftware.kryo.serializers.FieldSerializer accesses a method 'unsafe()' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.util.UnsafeUtil { sun.misc.Unsafe unsafe(); }'
Note: com.esotericsoftware.kryo.serializers.FieldSerializer accesses a method 'sortFieldsByOffset(java.util.List)' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.util.UnsafeUtil { java.lang.reflect.Field[] sortFieldsByOffset(java.util.List); }'
Note: com.esotericsoftware.kryo.serializers.FieldSerializerUnsafeUtil$Factory accesses a constructor '<init>(com.esotericsoftware.kryo.serializers.FieldSerializer)' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.serializers.AsmCacheFields$AsmObjectField { AsmCacheFields$AsmObjectField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.FieldSerializerAnnotationsUtil { FieldSerializerAnnotationsUtil(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.FieldSerializerGenericsUtil { FieldSerializerGenericsUtil(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.FieldSerializerUnsafeUtilImpl { FieldSerializerUnsafeUtilImpl(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField { ObjectField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectBooleanField { ObjectField$ObjectBooleanField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectByteField { ObjectField$ObjectByteField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectCharField { ObjectField$ObjectCharField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectDoubleField { ObjectField$ObjectDoubleField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectFloatField { ObjectField$ObjectFloatField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectIntField { ObjectField$ObjectIntField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectLongField { ObjectField$ObjectLongField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.ObjectField$ObjectShortField { ObjectField$ObjectShortField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.UnsafeCacheFields$UnsafeObjectField { UnsafeCacheFields$UnsafeObjectField(com.esotericsoftware.kryo.serializers.FieldSerializer); }'
Note: com.esotericsoftware.kryo.util.UnsafeUtil accesses a declared field 'theUnsafe' dynamically
Note: com.esotericsoftware.kryo.util.UnsafeUtil accesses a declared constructor '<init>(long,int,java.lang.Object)' dynamically
Note: com.esotericsoftware.kryo.util.Util accesses a method 'toString()' dynamically
Maybe this is program method 'com.esotericsoftware.kryo.Registration { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.pool.KryoPool$Builder { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.pool.SoftReferenceQueue { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.BeanSerializer$CachedProperty { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.FieldSerializer$CachedField { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.serializers.Generics { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IdentityMap { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IdentityMap$Entry { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IdentityObjectIntMap { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IntArray { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IntMap { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.IntMap$Entry { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.ObjectMap { java.lang.String toString(); }'
Maybe this is program method 'com.esotericsoftware.kryo.util.ObjectMap$Entry { java.lang.String toString(); }'
Note: there were 6 classes trying to access annotations using reflection.
You should consider keeping the annotation attributes
(using '-keepattributes *Annotation*').
(https://www.guardsquare.com/proguard/manual/troubleshooting#attributes)
Note: there were 7 classes trying to access generic signatures using reflection.
You should consider keeping the signature attributes
(using '-keepattributes Signature').
(https://www.guardsquare.com/proguard/manual/troubleshooting#attributes)
Note: there were 2 classes trying to access enclosing classes using reflection.
You should consider keeping the inner classes attributes
(using '-keepattributes InnerClasses').
(https://www.guardsquare.com/proguard/manual/troubleshooting#attributes)
Note: there were 17 accesses to class members by means of reflection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
(https://www.guardsquare.com/proguard/manual/troubleshooting#dynamicalclassmember)
Note: you're ignoring all warnings!
Unexpected error while performing partial evaluation:
Class = [com/esotericsoftware/kryo/Kryo]
Method = [writeClass(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Registration;]
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes))
Unexpected error while preverifying:
Class = [com/esotericsoftware/kryo/Kryo]
Method = [writeClass(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Registration;]
Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes))
Error: Can't find common super class of [com/esotericsoftware/kryo/io/Output] (with 1 known super classes) and [com/esotericsoftware/kryo/Registration] (with 1 known super classes)
Hi,
I cannot see any warnings in your build log related to this issue (or any other warnings). Is it possible you have -dontwarn
statements in your ProGuard configuration? If so, please comment these out.
It seems you are using ProGuard v7.1.0-beta2, please note this build is broken so it’s recommended to upgrade to ProGuard v7.1.0-beta3. Another benefit from upgrading to the latest beta is a more user friendly error for this issue mentioning exactly what the known super class are and thus giving a hint on what jar is missing from the input. You will need to add this missing jar to the input using either -injars
or -libraryjars
. If you have any difficulty in tackling the issue using the new beta, please do not hesitate to paste the newly generated build log in this thread.
Kind regards,
Jonas