ProGuard: keep private Inner Class
Asked Answered
B

3

7

How to keep private Inner Class in ProGuard. I am already using($ for inner class) below code in my proguard.cfg but its not working.

-keep public class com.xxx.droid.activity.LoginActivity$JsInterface
Buzzell answered 4/6, 2013 at 13:22 Comment(1)
I know this is old - may not get seen. Having a similar problem but the answer gives me a proguard error 'unknown class'Marlie
M
12

This should work:

-keep public class com.xxx.droid.activity.LoginActivity$* {
        *;
 }
Maud answered 4/6, 2013 at 13:28 Comment(0)
C
11

If the inner class is private, you shouldn't use the public keyword in the template, because it won't match. The compiler will actually compile the class as a package visible class (private classes don't exist at a bytecode level). Therefore:

-keep class com.xxx.droid.activity.LoginActivity$JsInterface
Cormack answered 4/6, 2013 at 23:8 Comment(0)
S
0

this worked for me

-keepattributes InnerClasses
Stopover answered 7/11, 2023 at 9:9 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.