Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 13039 [details]
A project to reproduce the problem
In order to work around https://bugzilla.xamarin.com/show_bug.cgi?id=34203, I tried creating my own binding for android-support-multidex. I took the JAR from the Android SDK - extras/android/support/multidex/library/libs. I have attached the project. Using MultiDexApplication as the base class of a custom Application in a Monodroid app causes Application.Context to be null.
You cannot simply replace Application class because then it won't initialize mono runtime anymore.
The MultiDexApplication class generated by my binding expectedly inherits from Application.
Have you been able to work around this problem?
I have exactly the same issue.
My workaround was that a binding for MultiDexApplication is actually useless. As Atsushi Eno has clearly explained at https://bugzilla.xamarin.com/show_bug.cgi?id=34203, Monodroid automatically generates Java code using MultiDexApplication as soon as support for multi-dexing is requested in the project properties. The problem to begin with was that because of a Google's bug which Atsushi Eno found multi-dexing failed with a certain version of the Android SDK, so I tried working around with it with my own binding. This, as you can see, failed, so using his guidance I simply upgraded the Android build tools we use to 23.0.1 where the bug in question has been fixed.
Thanks for quick response. I really appreciate this.
I didn't know about MultiDexApplication before.
In my case I guess there is nothing to do with this then.
I have a jar lib that contains base class MCEApplication: Android.App.Application
Then I create class MyApplication: MCEApplication and its Context is always null.
Thanks a lot anyways!
So the fix was to add this line to the .csproj file?
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Looks like the solution to this issue is to use the Sdk Build Tools version 23.0.1
Please reopen if that is not the case.