If I try to instantiate a .NET class derived from Java.Lang.Object
, a ClassNotFoundException
is thrown. This is easy to reproduce in a most basic project: create a new Android app using the Single-View App template, and add something like this:
public class Test1
{
}
public class Test2 : Java.Lang.Object
{
}
Then in the activity constructor:
var t1 = new Test1();
var t2 = new Test2();
The first line succeeds, the second line throws the exception. This happens both in the emulator and on the real device.
What am I missing? I'm using VS2017 and API 25 in case it's relevant. It seems like what I'm doing here must be a basic mistake, yet I couldn't find anything in Google on this particular issue.