Search code examples
androidxamarinxamarin.formsxamarin.androidxamarin-binding

Getting invalid opcode ba error while building Android project in Xamarin


I'm trying to build a Xamarin Forms application while building/deploying the application i'm getting this error enter image description here

Tried setting minsdk to 26 as well,did not work and I have a few Native Bindings as well, would that make any difference ?? I'm kinda stuck here, saw a couple of articles but that seems to be related to Android Native Java environment

any inputs would be deeply helpful


Solution

  • Xamarin.Android does not "out of the box" support using new Java 1.8 constructs and down-converting them to 1.7 (at least in the slightly older releases) and that is the error that you are getting concerning the Java opcode ba (assuming one of your binding is using it).

    You need to "desugar" the java 8 byte-code to 7:

    So, add the following in your Xamarin.Android projects to enable byte-code transformations:

    <AndroidEnableDesugar>true</AndroidEnableDesugar>