Exclude everithing but 1 package

Pretty self explinatory, its giving me an error when I build that I think is coming from a library, because I don’t use kotlin in my project. I’ve tried adding the maven-dependency-plugin and the flag -libraryjars ${project.build.directory}//Libs(**.jar) but its still throwing this error

https://paste.md-5.net/hoxuxojoqi.md

Dear @ISeal ,

First of all, thanks for posting your question here and welcome to the community!

Based on the error you are running into, certain super classes cannot be found. These types of errors are commonly part of the troubleshooting :

Warning: can’t find superclass or interface
Warning: can’t find referenced class
A class in one of your program jars or library jars is referring to a class or interface that is missing from the input. The warning lists both the referencing class(es) and the missing referenced class(es). There can be a few reasons, with their own solutions:

If the missing class is referenced from your own code, you may have forgotten to specify an essential library. Just like when compiling all code from scratch, you must specify all libraries that the code is referencing, directly or indirectly. If the library should be processed and included in the output, you should specify it with -injars, otherwise you should specify it with -libraryjars. For example, if ProGuard complains that it can’t find a java.lang class, you have to make sure that you are specifying the run-time library of your platform. For JSE, these are typically packaged in lib/rt.jar (vm.jar for IBM’s JVM, and classes.jar in MacOS X) or as of Java 9, jmods/java.base.jmod.

If the missing class is referenced from a pre-compiled third-party library, and your original code runs fine without it, then the missing dependency doesn’t seem to hurt. The cleanest solution is to filter out the referencing class or classes from the input, with a filter like “-injars myapplication.jar(!somepackage/SomeUnusedReferencingClass.class)”. DexGuard will then skip this class entirely in the input, and it will not bump into the problem of its missing reference. However, you may then have to filter out other classes that are in turn referencing the removed class. In practice, this works best if you can filter out entire unused packages at once, with a wildcard filter like “-libraryjars mylibrary.jar(!someunusedpackage/**)”.

If you don’t feel like filtering out the problematic classes, you can try your luck with the -ignorewarnings option, or even the -dontwarn option. Only use these options if you really know what you’re doing though.

Error: Can’t find any super classes of … (not even immediate super class …)
Error: Can’t find common super class of … and …
It seems like you tried to avoid the warnings from the previous paragraph by specifying -ignorewarnings or -dontwarn, but it didn’t work out. ProGuard’s optimization step and preverification step really need the missing classes to make sense of the code. Preferably, you would solve the problem by adding the missing library, as discussed. If you’re sure the class that references the missing class isn’t used either, you could also try filtering it out from the input, by adding a filter to the corresponding -injars option: “-injars myapplication.jar(!somepackage/SomeUnusedClass.class)”. As a final solution, you could switch off optimization (-dontoptimize) and preverification (-dontpreverify).

Please let me know if you have any other questions after reading through the above.

Kind regards,

Ewout

Hey @ewoutd !

Thanks for all of the help provided.
All of the missing classes are coming from dependencies that are absoloutely necessary for my project, so I have to ask if there is a way to import everything from the jars outputted by the maven-dependency-plugin into -injars.

I really don’t want to use -dontwarn or -ignorewarnings and this seems to come from the preverify stage as optimisation is already disabled as I am worried that it would cause problems as this is not a normal java application, but instead a plugin to a program so it does not use the normal entry point (public static void main(string[] args))

EDIT: I have temporanely added the option -dontpreverify and it is building but it still isn’t working

Dear @ISeal
Can you share exactly what is not working? The current configuration file, build log and stacktrace would help to get a good understanding of the issue you are currently running into.

Kind regards,

Ewout

I can’t share the details right now (the source code is on another pc) but when I tried to run it, i got a validation error; From doing some research it seems that the bytecode is corrupt? I can’t share much right now unfortunately