title: Define a base class for application class in Xamarin.Android and MvvmCross
body: <p>I have an XYZ module, which is mainly a pre-built Xamarin Android java bindings library with some c# classes. In a "standalone" Xamarin Android project it works perfectly. But now I would like to implement as a plugin in my big cross-platform Xamarin project, which uses the MvvmCross framework, and follows the MvvmCross standard patterns.</p>
  
  <p>The XYZ module requires to set a base class for the Android Application class, like this:</p>
  
  <pre><code>[Application]
  public class Application : XYZApplication
  {
    public Application(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
    { }
    public override void OnCreate()
    { base.OnCreate();}
  }
  </code></pre>
  
  <p>Normally no application class is presented, the MvvmCross Setup.cs gets it from the core project, the CreateApp() method returns this class from the core:</p>
  
  <pre><code>public class App : MvxApplication
  {
     public override void Initialize()
     {
       CreatableTypes().EndingWith("Service").AsInterfaces().RegisterAsLazySingleton();
       RegisterAppStart&lt;ViewModels.StartupViewModel&gt;();
      }
  }
  </code></pre>
  
  <p>If I don't specify the Application class with the ApplicationAttribute, the XYZ module fails in its plugin. If I do, then the MvvmCross framework fails, when it want to load my plugins, the pluginloader fails with the very first plugin at this line: </p>
  
  <pre><code>manager.EnsurePlatformAdaptionLoaded&lt;PluginLoader&gt;(); 
  </code></pre>
  
  <p>with the message "could not resolve type".</p>
  
  <p>I think the source of the problem, that the Application class cannot have two base classes, or cannot be created twice?
  Maybe there is a solution, if you need an application class defined, having a base class while using MvvmCross.</p>