AOT issue with mvvmcross - c#

I'm unable to build Xamarin projects that reference MvvmCross as I receive the error:
Error MT3001: Could not AOT the assembly '/Users/chriskoiak/Documents/Initial/Mobile Clients/xxxx/obj/iPhone/Debug/mtouch-cache/Build/Cirrious.CrossCore.dll' (MT3001)
Error MT3001: Could not AOT the assembly '/Users/chriskoiak/Documents/Initial/Mobile Clients/xxxx/obj/iPhone/Debug/mtouch-cache/Build/Cirrious.MvvmCross.dll' (MT3001)
This error occurred after I upgraded to xcode5, mvvmcross 3.0.12 Xamarin.iOS 7.0.0.11
Has anyone else experienced this problem or can suggest a fix?
Thanks

This is a little bug that has appeared in the initial Xamarin.iOS 7 release, caused by the transition to "real" PCL reference assemblies on OS X. The developers are working to get this fixed right away, but in the meantime there is a work-around. Specifically, you can add -linkskip=System.Net -linkskip=System.Windows to the "Additional mtouch arguments" under Project Options -> Build -> iOS Build. This will tell the linker not to try to link System.Net or System.Windows.
Update:
A corrected version of Xamarin.iOS (7.0.1) has now been released to the alpha channel. When using this latest version, the linksip work-around should no longer be needed.

Related

'Could not resolve type with token 010001d6 from typeref (expected class 'NavigationItemReselectedEventArgs' in assembly '')' encountered

Does anyone encounter this error after upgrading from C# Xamarin.Forms 4.8 to 5.0.0.2515?
System.TypeLoadException: 'Could not resolve type with token 010001d6 from typeref (expected class 'NavigationItemReselectedEventArgs' in assembly '')'
The error occurs on this line:
bottomNavigationView.NavigationItemReselected += BottomNavigationView_NavigationItemSelected;
Or is there a workaround? if the line above is deprecated in Xamarin.Forms 5.X?
When I revert back the xamarin.forms version to 4.8, application works well.
Please help. Thanks
1. Please check the nuget packages Xamarin.Forms on each platform project, and make sure the versions are the lastest and the same.
2. If the method above does not work, try to create a new project and copy the sample code into it, and then try again.

Issue with nuget package Xamarin.Firebase.iOS.CloudMessaging 3.1.2

I get many error messages if I install the Xamarin.Firebase.iOS.CloudMessaging 3.1.2 nuget package.
Error: linker command failed with exit code 1 (use -v to see invocation)
Error MT5210: Native linking failed, undefined symbol: _FIRLogBasic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
Error MT5211: Native linking failed, undefined Objective-C class:
FIROptions. The symbol '_OBJC_CLASS_$_FIROptions' could not be found
in any of the libraries or frameworks linked with your application.
Error MT5211: Native linking failed, undefined Objective-C class:
GULAppEnvironmentUtil. The symbol
'_OBJC_CLASS_$_GULAppEnvironmentUtil' could not be found in any of the
libraries or frameworks linked with your application.
Error MT5201: Native linking failed. Please review the build log and
the user flags provided to gcc: -ObjC
Error MT5202: Native linking failed. Please review the build log.
I tried uninstalling and reinstalling the nuget package but I still get the same errors.
I use Visual Studio Community for Mac 8.1.5 (build 9).
I need Xamarin.Firebase.iOS.CloudMessaging because I follow this tutorial: https://www.robbiecode.com/setup-push-notifications-with-firebase-in-xamarin-forms-for-ios/
What is wrong with my project? What can I do?
The following two projects are in my solution:
InapppurchaseTest.iOS, MonoGame.Framework.iOS (develop)
Well, this is a well-known issue with Firebase and Xamarin, what basically happens here is the old bin and obj files while interacting with the new data override some existing files that are needed by iOS to synthesize the IPA while deployment and hence ends up throwing linking RELATED errors, follow the below steps and it will clear this mess.
Clean bin and obj
Delete the builds in the following path of your MAC machine - ~/Library/Caches/Xamarin/mtbs/builds/ProjNAME where 'ProjName' is the name of the project you are currently working on
Once you are done with both the above steps add the Xamarin.Firebase.iOS.CloudMessaging package and change linker setting to Don't Link (this is for the time being)
After installing these packages see to it that you build your project dependency wise which means PCL'S and .Net standards first then the native iOS project.
Clean bin and obj again if it does not work for the first build...
This should solve your issues in case it does not repeat the above procedure.
EDIT
If you check the GitHub comment by SotoiGhost here, it says adding the below line anywhere in your project should solve this issue...
var foo = Firebase.Core.Configuration.SharedInstance;
Feel free to get back in case of issues
Good luck!

How to resolve the conflict between 2 mscorlib versions in Visual Studio and Xamarin Studio?

For more than 2 days I have been trying to fix this error, but I have not succeeded.
This is the error :
No way to resolve conflict between "mscorlib, Version=2.0.5.0,
Culture=neutral, PublicKeyToken=7cec85d7bea7798e" and "mscorlib".
Choosing "mscorlib, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e" arbitrarily.
I searched about it and so many people had this problem, but I couldn't find a solution for it.
Finally, how can we find a way to resolve the conflict between these 2 references?
Issue I Faced: No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral,...............
Till now I have not succeeded in finding out the root cause, but I followed the steps to resolve the issue,
Open Android device manager, and try starting the android simulator of interest.
If it launches and states some error: stating to do a "Factory Reset", Stop the simulator and do the same.
Try Starting the Simulator, it works.
Hope this works for you too!!!
I don't have an answer but can provide the following:
I have a blank Xamarin.Forms app targeted only to Android. I can build and deploy this one without any errors.
I downloaded a Xamarin.Forms example from the Xamarin website and kept only the Android version. In this case I can rebuild the solution without any errors; however, when I try Start Without Debug, I get the exact error you report.
From these results I gather the following:
The conflict between mscorlib versions is not related to the configuration of Visual Studio 17 but to the configuration of the app.
The second of the links you included mentions installing a specific version of newtonsoft.json. Since this is a Nuget package, I thought that the problem would be with specific versions of these packages. Both of my apps use the same packages, but maybe the debug process doesn't necessarily use the same features of those packages.
I hope this helps.

Xamarin App builds and runs on simulator, but on real phone I get Assembly Failure

I am working on a Xamarin based mobile app. It has previously deployed to an iPhone, and is currently working on the simulator. However, when I try to Debug on my iPhone, I get:
Error MT2002: Failed to resolve assembly: 'PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64' (MT2002) (My_App.iOS)
PCLStorage is installed and up to date in my iOS and Core projects, although neither have any references to the package. It was installed when I added the AWS Core SDK. How do I resolve this error, I assume that is what is stopping the debug on iPhone?
Edit: (based on Answer below)
If I disable the linker in my build settings, I get the error:
My_App/iOS/MTOUCH: Error MT3001: Could not AOT the assembly 'My_App/iOS/obj/iPhone/Debug/build-iphone4.1-9.2.1/mtouch-cache/Build/AWSSDK.Core.dll' (MT3001) (My_App.iOS)
I would really appreciate some suggestions as I haven't made much headroom with this...
Try disabling "Linker" in the build options for Device builds. It's possible that if you are not directly referencing the library, the linker is stripping it out, causing it to fail at runtime.
I just had the same problem after switching from the simulator to an actual device
Fortunately, I've gotten the error only in 3 pages...
Fix was to remove the assembly attribute from the XAML:
From
xmlns:viewModels="clr-namespace:XXX.ViewModels;assembly=XXX"
To
xmlns:viewModels="clr-namespace:XXX.ViewModels"

MvvmCross 4 and WPF SQLite plugin

In MvvmCross 4.0.0 the Community SQLite plugin has been replaced with new SQLite-PCL plugin (if I am not mistaken).
It works great in my Android application, but when I tried to use it in WPF application I faced problems.
When package is installed from nuget there's no default Bootstrap file, therefore Mvx runtime fails to resolve classes like MvxSqliteConnectionFactory.
When I add bootstrap code manually I get error like:
A first chance exception of type Cirrious.CrossCore.Exceptions.MvxException occurred in WindowsBase.dll
Version Unknown : Time 26/10/2015 08:53:16.232 PM: Error : 1.30 Exception: could not load plugin assembly for type MvvmCross.Plugins.Sqlite.PluginLoader
I figured that runtime is not able to load assembly probably because it does lookup by appending .Wpf suffix to the name of the plugin, so it looks for assembly MvvmCross.Plugins.Sqlite.Wpf or something like that. But there's no such library, in repository there's only WindowsUWP version.
What can I do to fix the problem and how do I use this plugin in WPF app?
WPF plugin added to MvvmCross repos, please check out the latest prerelease version.

Categories