Related: https://xamarinhq.slack.com/archives/C03CEGRUW/p1570637567058600
When using a new $(TargetFrameworkVersion), the Mono.Android.Platform*.apk framework package that gets created (in %localappdata%\Xamarin.Android\Cache) may not include Mono.Android.Export.dll, resulting in the application crashing on startup on a FileNotFoundException, because the assembly is not found. This is because the assembly is only shipped as part of framework4.4 and the logic that creates the platform apk is not looking back in the directories.
Build log: https://gist.github.com/joj/86c2bb5e2b1c27a059d93fabcda8e59c
Install log: https://gist.github.com/joj/4b897196fedc02cf88772260b5dbf534
The simple workaround is to copy the dll in the Reference Assemblies folder for the platform that's being targeted, and to delete the file in the cache and uninstall the framework package in the emulator.
Same issue on VS 16.4.0 Preview 2.0 (Xamarin.Android SDK - 10.1.0.1)
Same issue with the following configuration:
=== Visual Studio Community 2019 for Mac (Preview) ===
Version 8.4 Preview (8.4 build 1936)
Installation UUID: d21e793f-19e4-4ced-b18f-cd2d572d6421
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)
Package version: 606000140
=== Mono Framework MDK ===
Runtime:
Mono 6.6.0.140 (2019-08/1b2e536b223) (64-bit)
Package version: 606000140
=== Roslyn (Language Service) ===
3.4.0-beta1-19462-14+2f21c63bb29a816d4a62191a1a0739deb64d387c
=== NuGet ===
Version: 5.3.0.6192
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Versions:
3.0.100
3.0.100-rc1-014190
3.0.100-preview9-014004
3.0.100-preview8-013656
2.1.701
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.0.0
3.0.0-rc1-19456-20
3.0.0-preview9-19423-09
2.1.13
2.1.12
=== Xamarin.Profiler ===
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 10.1.0.1 (Visual Studio Community)
Commit: xamarin-android/d16-4/ee1dfb6
Android SDK: /Users/omatrot/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 28.0.3
Build Information:
Mono: 5281037
Java.Interop: xamarin/java.interop/d16-4@35b08ba
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/omatrot/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.4.0.1
Hash: 59c7487
Branch: remotes/origin/d16-4
Build date: 2019-10-10 19:59:24 UTC
=== Android Device Manager ===
Version: 16.4.0.6
Hash: ef7da72
Branch: remotes/origin/d16-4
Build date: 2019-10-10 19:59:46 UTC
=== Xamarin Designer ===
Version: 16.4.0.354
Hash: 55d926c06
Branch: remotes/origin/d16-4
Build date: 2019-10-08 15:08:26 UTC
=== Apple Developer Tools ===
Xcode 11.1 (15405)
Build 11A1027
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 13.8.1.1 (Visual Studio Community)
Hash: 2e360ee4
Branch: d16-4
Build date: 2019-10-08 09:18:28-0400
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 804001936
Git revision: d5dd56f1f8ce59c3afc2ebac236e24a2b808c1c9
Build date: 2019-10-24 10:18:13+00
Build branch: release-8.4-preview1
Xamarin extensions: 091a2a9cac7e9d0faba987aa7f76975c6281b9d1
=== Operating System ===
Mac OS X 10.15.1
Darwin 19.0.0 Darwin Kernel Version 19.0.0
Sat Oct 19 23:25:33 PDT 2019
root:xnu-6153.41.3~36/RELEASE_X86_64 x86_64
System.IO.FileNotFoundException: Could not load the file 'Mono.Android.Export'.
at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly, System.Threading.StackCrawlMark& stackMark) [0x00035] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/corlib/System/AppDomain.cs:817
at System.AppDomain.Load (System.String assemblyString) [0x00002] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/corlib/System/AppDomain.cs:796
at at (wrapper remoting-invoke-with-check) System.AppDomain.Load(string)
at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/corlib/System.Reflection/Assembly.cs:429
at Android.Runtime.AndroidTypeManager.CreateDynamicCallback (System.Reflection.MethodInfo method) [0x0000d] in <4ed855fb65824da79e2edd6f6bb06c94>:0
at Android.Runtime.AndroidTypeManager.RegisterNativeMembers (Java.Interop.JniType jniType, System.Type type, System.String methods) [0x000f2] in <4ed855fb65824da79e2edd6f6bb06c94>:0
at Android.Runtime.JNIEnv.RegisterJniNatives (System.IntPtr typeName_ptr, System.Int32 typeName_len, System.IntPtr jniClass, System.IntPtr methods_ptr, System.Int32 methods_len) [0x00115] in <4ed855fb65824da79e2edd6f6bb06c94>:0
at at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_alloc_object(intptr,intptr&,intptr)
at Java.Interop.JniEnvironment+Object.AllocObject (Java.Interop.JniObjectReference type) [0x00027] in <e85f8f7e7f794240ac4758e206676ac4>:0
at Java.Interop.JniType.AllocObject () [0x0000c] in <e85f8f7e7f794240ac4758e206676ac4>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.StartCreateInstance (System.String constructorSignature, System.Type declaringType, Java.Interop.JniArgumentValue* parameters) [0x00044] in <e85f8f7e7f794240ac4758e206676ac4>:0
at Android.Views.View..ctor (Android.Content.Context context, Android.Util.IAttributeSet attrs) [0x00082] in <4ed855fb65824da79e2edd6f6bb06c94>:0
at Com.Syncfusion.Gauges.SfCircularGauge.PointerRenderer..ctor (Android.Content.Context context, Android.Util.IAttributeSet attrs) [0x00021] in <38980d9335f349459e463465a8ffea2d>:0
at Com.Syncfusion.Gauges.SfCircularGauge.PointerRenderer..ctor (Android.Content.Context gaugeContext, Com.Syncfusion.Gauges.SfCircularGauge.SfCircularGauge circularGauge, Com.Syncfusion.Gauges.SfCircularGauge.CircularScale circularScales, Com.Syncfusion.Gauges.SfCircularGauge.CircularPointer circularPointers) [0x00000] in <38980d9335f349459e463465a8ffea2d>:0
at Com.Syncfusion.Gauges.SfCircularGauge.SfCircularGauge.RefreshGauge () [0x002c3] in <38980d9335f349459e463465a8ffea2d>:0
at Com.Syncfusion.Gauges.SfCircularGauge.SfCircularGauge.set_CircularScales (System.Collections.ObjectModel.ObservableCollection`1[T] value) [0x00007] in <38980d9335f349459e463465a8ffea2d>:0
at etp.MainActivity.UpdateGoalsTextAndScore () [0x004b2] in /Users/omatrot/Documents/hygeex/etp/etp_proto/etp_proto/Sources/MainActivity.Goals.cs:120
at etp.BuildMainActivityScreenAsyncTask.OnProgressUpdate (Java.Lang.Object[] values) [0x00050] in /Users/omatrot/Documents/hygeex/etp/etp_proto/etp_proto/Sources/BuildMainActivityScreenAsyncTask.cs:100
at Android.OS.AsyncTask.n_OnProgressUpdate_arrayLjava_lang_Object_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_values) [0x00020] in <4ed855fb65824da79e2edd6f6bb06c94>:0
at at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.53(intptr,intptr,intptr)
The fix for this should be in d16-4 Preview 3
Release status update
A new Preview version has now been published that includes the fix for this item.
Fix included in Xamarin.Android 10.1.0.29.
Fix included on Windows in Visual Studio 2019 version 16.4 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
Most helpful comment
Release status update
A new Preview version has now been published that includes the fix for this item.
Fix included in Xamarin.Android 10.1.0.29.
Fix included on Windows in Visual Studio 2019 version 16.4 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.