Error: Can't find common super class of

后端 未结 4 1462
清酒与你
清酒与你 2021-01-02 03:14

I am trying to process with Proguard a MS Windows desktop application (Java 6 SE using the SWT lib provided by Eclipse). And I get the following critical error:



        
相关标签:
4条回答
  • 2021-01-02 03:40

    Try removing the -dontnote option. You may have duplicate definitions that you aren't receiving warnings for, or maybe you're ignoring the warnings.

    0 讨论(0)
  • 2021-01-02 03:50

    I had the same issue but did not try specifying the -dontskipnonpubliclibraryclasses or any other option to get fixed. My problem was occurring on java.lang.StringBuffer class, which was very weird. StringBuffer class was being used all over the project and the error did not occur anywhere else.

    To fix, all I did was to move the scope of StringBuffer.

    OLD Code - with error:

    function(){
       if(condition){
           StringBuffer buffer = new StringBuffer();
           //additional code
       }else if(condition){
           StringBuffer buffer = new StringBuffer();
           //additional code
       }
    }
    

    NEW Code - without problem.

    function(){
        StringBuffer buffer = new StringBuffer();
    
           if(condition){
    
               //additional code
           }else if(condition){
    
               //additional code
           }
        }
    

    I have a feeling this has to do something with ProGuard and how it parses the code.

    0 讨论(0)
  • 2021-01-02 03:52

    I had an issue with an application depending on various other projects. I tried the listed solutions, but none of them help. Based on tests, the shrinking and preverify steps were correctly running, the optimization threw the error:

    > java.io.IOException: java.lang.IllegalArgumentException: Can't find common super class of [java/io/File] (with 2 known super classes) and [org/antlr/v4/runtime/tree/gui/TreeViewer] (with 1 known super classes)
    

    I tried keeping (-keep options) both classes without any success. Based on other threads I found the minimal solution is to disable variable optimization:

    -optimizations !code/allocation/variable
    

    This lets me compile successfully, but has its drawbacks.

    0 讨论(0)
  • 2021-01-02 03:55

    Try adding the option -dontskipnonpubliclibraryclasses to your command line.

    From the Proguard Manual:

    Limitations

    For efficiency, ProGuard always ignores any private or package visible library classes while reading library jars. If any of them are extended by public library classes, and then extended again by input classes, ProGuard will complain it can't find them. In that case, you'll have to use the -dontskipnonpubliclibraryclasses option, and maybe even the -dontskipnonpubliclibraryclassmembers option. The graphical user interface has checkboxes for these settings.

    0 讨论(0)
提交回复
热议问题