Forum Xamarin.Android

java.lang.NoClassDefFoundError when building App referencing Android Binding Project


I've created a project to bind a java aar. The project is composed of:

  • one binding project to bind the top-level AAR (the main AAR)
  • another binding project for an AAR dependency (the referenced AAR)
  • NuGet packages for dependencies
  • a Xamarin.Android app referencing the main Android binding project

The binding projects for the two AAR build correctly but when I build the app, I get the following error:
COMPILETODALVIK : Uncaught translation error : invalid opcode ba (invokedynamic requires --min-sdk-version >= 26
After some research I found that it could come from some not supported Java 8 features.
So I added <EnabledDesugar>True</EnabledDesugar> as a workaround but now I'm getting a:
java.lang.NoClassDefFoundError : org/webrtc/VideoRenderer$Callbacks

The VideoRenderer.Callbacks is present in the referenced AAR and corresponds to a nested interface (a Java 8 feature, isn't ?). It is used in the main AAR.

public class VideoRenderer
public interface Callbacks
void renderFrame(final I420Frame p0);

I think it's important to add the App build fine when using just the project for the referenced AAR. The error appears when referencing the main binding project.

I know the best would be to wait for the D8 dexer integration in Xamarin, but wouldn't be a workaround in the mean time ?



Sign In or Register to comment.