Search code examples
androidxamarinxamarin.androidandroid-proguard

Xamarin.Android JARTOXML missing class error was raised while reflecting 'ClassName' : Expecting a stackmap frame at branch target 18


Original aar lib is compiled with API level 24 and obfuscated with latest proguard 5.3.1. This lib is added to the xamarin.android binding library project. Xamarin targets JDK8 in preferences jdk1.8.0_91.

The result is lots of warning on build like the following:

"missing class error was raised while reflecting "CLASS" : Expecting a stackmap frame at branch target 18"

As a consequence, there is no generated code for that classes. Is there any idea what could be done ?

Any help is appreciated

P.S. Without obfuscation binding generation works as expected.


Solution

  • Jar2Xml has some specific behavior based on the JDK used:

    JDK 1.7 will skip types that it decides are obfuscated. Because of this, you won't get any parser errors.

    JDK 1.8 however will throw these parser errors but only for types that wouldn't be bound.

    Try de-obfuscating your library via:

    https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#missing-types--obfuscated-types

    Note: Have you tried class-parse yet instead of Jar2Xml?

    https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#pick-your-tooling

    This issue was cleared up in class-parse recently

    https://github.com/xamarin/java.interop/pull/92