0

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

Venky
  • 1,929
  • 3
  • 21
  • 36

2 Answers2

1

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>  
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • where should i add this again ??, in csproj right ?? – Venky Dec 28 '18 at 10:54
  • yes, in the Xamarin.Android based projects (`.csproj`), add it in the default prop group. Also beware that some versions of Xamarin.Android did not desugar error free if multi-dex/proguard were not enabled, this has been fixed in the most recent versions – SushiHangover Dec 28 '18 at 10:56
  • i'm getting an error like this now ,Severity Code Description Project File Line Suppression State Error java.lang.NoClassDefFoundError : com/google/android/exoplayer2/source/BaseMediaSource – Venky Dec 28 '18 at 11:58
  • `NoClassDefFoundError` sounds like the java class is stripped.... do you have the Mono linker and/or proguard enabled? I would post another question with the details – SushiHangover Dec 28 '18 at 20:34
  • 1
    In the next Visual Studio 2019 / Visual Studio for Mac preview release, you will be able to use `d8` and `r8` which include `desugar` by default. This current method is using a very old version of `desugar` and will be deprecated in favor of using the new dex compiler (d8).https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/D8andR8.md#so-how-do-developers-use-it-what-are-sensible-msbuild-property-defaults – Jon Douglas Jan 02 '19 at 06:29
0

In VisualStudio 2019 you can set the property in the Android project properties -> Android options -> Dex Compiler and choosing d8 enter image description here