keep specific inner class in android proguard

Viewed 17

how can i keep inner class in android when use proguard.

i have a class

class A{
  public void setXX(B b){}
  public interface B{ }
}

when i use prouard in android it will become

class A{
  public void setXX(A$B b){}
}

B will become A$B too,how can i keep it the same as public void setXX(B b){}

in the proguard files ,i set as follow:

-keep class A$* {
    *;
}
-keep class A$B {
    *;
}

and when i use -keepattributes InnerClasses ,it worked ,but it will keep all the inner classes,how can i keep only the specific inner class ?

1 Answers

try this

using @Keep annotation

 @Keep
    class A{       
        //inner class
        @Keep
        class B{
        }
    }  
Related