6

We are creating an Android library with an inner interface class. The problem we are facing is that the method parameter names are not preserved for interface class in the release build aar file. Although .aar file works fine, this creates problem in editor when using autocompletion, Implement methods etc. Please note that proguard is disabled.

public class Test {

       public interface TestInterface {
            void testCallback(int ordernumber, int vendorid);
       }

       public boolean init(Context context);
}

In the debug build, class is preserved fine. However, in the release build, parameter names of interface methods are not preserved. Interestingly it preserves parameter names of class methods. This I verified using decompiler.

public class Test {

       public interface TestInterface {
            void testCallback(int paramInt1, int paramInt2);
       }

       public boolean init(Context context);
}

I also tried setting debuggable flag in buildconfig without any help.

Will appreciate any help.

mesibo
  • 3,970
  • 6
  • 25
  • 43
  • I am still looking for the solution, any insight please. – mesibo Jun 02 '16 at 13:53
  • Did you found this solution? I've also faced in this problem. – LaLaAsDev Jun 26 '16 at 02:30
  • I found solution. but It seems to there is no options to prevent rename parameters on interface methods. only available solution is generate javadoc or androidSourcesJar file and publish with aar file – LaLaAsDev Jun 26 '16 at 03:37
  • I have added javadoc for interface methods and it didn't helped. I import lib (HybridMediaPlayer) from gradle. How to add javadoc correctly? – Mateusz Kaflowski May 01 '18 at 10:39

1 Answers1

0

The official oracle docs state that interfaces do not preserve parameter names, so the only solution is including the docs with the library: Preserving parameter/argument names in compiled java classes

Community
  • 1
  • 1
natanavra
  • 2,100
  • 3
  • 18
  • 24