2

I created a Xamarin Binding Project for Android, and generated the Bindings for the .aar file. So far, so good. When I first called a constructor which throws an Exception, a build error occured:

.../XamVideoCaptureReader.java(9,9): Error: error: unreported exception ReaderException; must be caught or declared to be thrown super (p0, p1, p2); (AndroidTest)

On the following code part:

public XamVideoCaptureReader (int p0, com.digimarc.dms.readers.ReaderOptions p1, com.digimarc.dms.readers.image.CaptureFormat p2) { super (p0, p1, p2); ... }

I think the error is pretty self explanatory, but I can't find a way to fix it. The super call has to be wrapped in a try catch, or even better: a throws ReaderException should be added to the constructor signature.

Has anyone experienced this error before and could solve it? Or is this a bug of Xamarin?

  • If you use `throws ReaderExcetpion` in your `super(p0,p1,p2)` method, you must handle it after you call it. There are two ways to handle it. Like you have said, first, use `try-catch` to wrap it; second, continue to `throws ReaderException`. You could refer to this link:https://stackoverflow.com/questions/37424284/unreported-exception-java-lang-exception-must-be-caught-or-declared-to-be-throw – Robbit Dec 05 '17 at 06:36
  • Yeah, I know. But the Java Code is autogenerated by the bonding library Xamarin uses. I think i will just open an issue in their forums. – Alexander Haas Dec 05 '17 at 06:52
  • Could you please show your java code? – Robbit Dec 05 '17 at 07:31
  • I don't have it... All the Java Code is packed in a single .aar file. I'm trying to create C# Bindings for that library. – Alexander Haas Dec 05 '17 at 08:18
  • So, you handle the `ReadException` in your C# code with one of the two ways, but it doesn't work? Because I can't see any `try -catch` or `throws ReaderException` in your c# code. Could you please show me? – Robbit Dec 05 '17 at 08:52
  • @AlexanderHaas were you able to solve this issue? – Bogdan Daniel Feb 19 '19 at 07:26

0 Answers0