Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle cannot find symbol of inner class after proguard

My gradle project contains one main module and one library

One class of the library contains an enum, I´ve excluded from proguard obfuscation because it is used in the main project.

Gradle fails on build with "error. cannot find symbol variable MyEnum" and the same error goes as well for another interface, which is also declared inside a class

I´ve decompiled the classes.jar file of my library, which was generated on build and the enum is at exactly the place where it "cannot be found" as MyClass$MyEnum. The class "MyClass" is also still existing at its right place after compiling.

this is the proguard code I´ve used for my enum:

-keep,allowoptimization enum com.mypackage.MyClass$MyEnum {
    public static **[] values();
    public static ** valueOf(java.lang.String);
    **[] $VALUES;
    public *;
 }

I´m not allowed to post any code

Is there any special trick with inner classes, when using proguard??

like image 809
Marian Klühspies Avatar asked Nov 14 '14 12:11

Marian Klühspies


1 Answers

Not testet as I have extracted my inner class now, but this should work

-keep class my.outer.Class$MyInnerClass
-keepattributes InnerClasses
like image 193
Marian Klühspies Avatar answered Nov 15 '22 05:11

Marian Klühspies