MVVMCross PictureChooserTask load exception - xamarin.android

I am creating an Android project with MVVMCross and Xamarin on Mac using Xamarin Studio. Everything has been going terrific until I got to needing to use the camera. I downloaded and installed the PictureChooserTask plugin. The issue I am having is after adding the dll's to the Android project and calling:
Cirrious.MvvmCross.Plugins.PictureChooser.PluginLoader.Instance.EnsureLoaded ();
I now can't run the application. It fails during startup with the following error:
Missing method AddOrOverwriteFrom in assembly .override/Cirrious.MvvmCross.Plugins.PictureChooser.Droid.dll

The solution that worked for me was to just manually register the singleton type using the following:
Mvx.RegisterType<IMvxPictureChooserTask, MvxPictureChooserTask> ();

Related

"MapView not found in Esri.ArcGISRuntime.Xamarin.Forms" error Xamarin Forms iOS

I am using ArcGIS Runtime 100.4.0 in my Xamarin forms solution which is consist of
Android Project
iOS
.Net Standard 2 project (shared logic used by android and ios)
My code is very simple and it only tries to display a map. I used the code from Esri example for displaying a map and I already have it working in another project where the app logic is in a Visual Studio Shared Project (instead of .net standard). The Esri sample project also uses Visual Studio Shared Project. I think the issue that I am facing can be resolved by using Visual Studio Shared Project but for some technical reasons I have to use .Net Standard for my shared logic.
Now here is the issue:
The android app shows the map without an issue, however in my iOS app, I get the following error in my .net standard project when the app tries to initialize the map:
MapView not found in xmlns clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms
I am confident that I have all right references in my iOS project and also the fact is the error happens in the .net standard project which is working in my Android app.
How is it possible to be missing MapView class when using my .netstandard project in iOS but not android?
While I was investigating this I found a solution which I have no clue about the reason:
I added a line before InitializeComponent() in my page code behind which simply creates an instance of Esri.ArcGISRuntime.Xamarin.Forms.MapView, and that fixed it:
public MapPage()
{
var a = new Esri.ArcGISRuntime.Xamarin.Forms.MapView();
InitializeComponent();
}
If I remove that line I get the error again in iOS. I have no idea why that happens

Reference to type 'System.IConvertible' claims it is defined in assembly mscorlib

Anytime I try to reference an NUNIT data type in the iOS framework, I am given a compiler error saying it can't find the IConvertible type
Error CS7069: Reference to type System.IConvertible' claims it is defined assemblymscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found (CS7069) (logic)
I was able to reproduce this by creating a brand new Xamarin.Forms project that only targets iOS.
Immediately after creating it, I added a second Xamarin.Forms project, this time a PCL.
I then needed to add the Xamarin.iOS library so that I can reference the iOS specific APIs, specifically the Photos API. I did this by navigating to
~/Library/Frameworks/Xamarin.iOS.framework/Versions/9.0.1.29/lib/mono/Xamarin.iOS/Xamarin.iOS.dll
Lastly, I added a blank class to the new PCL project, and created a locally scoped NUNIT field. This is where the compiler error happens. This happens in my current project when I try to get the number of photos in a PHAssetCollection, as that is an NUNIT data type.
using System;
namespace logic
{
public class EmptyClass
{
public EmptyClass()
{
nuint test = 5;
}
}
}
This gives me the compiler error I've referenced above. How can I solve this? This has become a blocking issue for me, am I referencing the wrong Xamarin.iOS.dll? It's not available in the list of nuget packages when I scan for them, so I can't add it via NuGet. NuGet only has Xamarin.Forms.dll available.
Update 1
After trying a few different combinations, I think that I have a working solution. Instead of creating a Xamarin.Forms Library, I created a normal iOS PCL library instead. This solved that problem.
I don't know why the Xamarin.Forms library wouldn't work. Is it not intended to be used for platform specific code?
Xamarin Forms PCL's need to be platform agnostic. If you have a NUnit project that needs access to a Xamarin.iOS specific reference, then you need to build within the iOS project / iOS PCL.
Xamarin.iOS.dll can only be referenced from a iOS related project.

Oxyplot Run Xamarin forms iOS not found ref to OxyPlot.Xamarin.iOS

I am creating an application in Xamarin Forms and I'll show graphs with OxyPlot, running the Hello World OxyPlot on Android and Windows Phone running, but I have a problem with IOS. When the emulator loads the application sends the following:
{System.IO.FileNotFoundException: Could not load file or assembly ‘OxyPlot.Xamarin.iOS’}
and the stack:
System.AppDomain.Load (assemblyRef={OxyPlot.Xamarin.iOS, Version=2015.1.889.0, Culture=neutral, PublicKeyToken=null}, assemblySecurity=(null)) in /Users/builder/data/lanes/1962/8b265d64/source/mono/mcs/class/corlib/System/AppDomain.cs:706
it seems that does not refer to Packete Oxyplot.xamarin.iOS but not how to solve it.
I have added Nuget pre-release of OxyPlot Xamarin Forms, in each platform. As I mentioned in android and windows phone (using visual studio) is working properly.
I appreciate your attention and stay tuned if more data is needed.
greetings
Make sure you have https://www.nuget.org/packages/OxyPlot.Xamarin.Forms/ installed. Then, you need to initialize the OxyPlot renderers by adding the following call just before Xamarin.Forms.Forms.Init():
iOS: OxyPlot.Xamarin.Forms.Platform.iOS.Forms.Init();
Android: OxyPlot.Xamarin.Forms.Platform.Android.Forms.Init();
WinPhone: OxyPlot.Xamarin.Forms.Platform.WinPhone.Forms.Init();
OR
It's possible that assembly is cut because of Xamarin linker. Add:
var ignoreOxyplot = typeof(OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer) in iOS project FinishedLaunching method.
See: http://forums.xamarin.com/discussion/comment/122219

MvvmCross sample projects run

I'm trying to introduce myself into the MVVMCross project, but I can not run the sample MonoDroid projects in the emulator. The WinPhone7 project run perfectly.
I get the following error during the Copying application to device process
http://snag.gy/PCY39.jpg
I tried the MonoCross sample projects, it runs correctly. What am I doing wrong?
I think that means that one of the Android SDK add-on libraries you are trying to use is not available on the device/emulator. An example would be if the Google maps .jar isn't on the device and you are trying to use it.
I've just pushed some changes to GitHub which separate the Maps dependencies out into a separate assembly.
You will still need Maps installed (follow instructions like http://3zwireless.com/Android1.html) for the Conference sample, but Tutorial, BestSellers, TwitterSearch, SimpleDroid, and CustomerManagement should install and run on a non-mapping Emulator.

Mono For Android Hello World code throws AndroidManifest.xml error

I recently downloaded the trial version of Mono For Android. I tried running the Hello World tutorial. I receive the following error:
Tried to launch activity 'HelloMonoDroid.HelloMonoDroid/hellomonodroid.Activity1', but the device could not find it.
A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.
Consider using the [Activity] attribute instead:
http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml
I triple checked my code and didn't see any differences between it and the posted code in the tutorial. So I tried to create a new Mono For Android Project and ran it without modification. I named the Project Driver. Here is the error I received:
Tried to launch activity 'Driver.Driver/driver.Activity1', but the device could not find it.
A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.
Consider using the [Activity] attribute instead:
http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml
Notice it is the same as the original error with only the activity name changed. This is a simple solution. I am not creating a AndroidManifest.xml file manually. Is this a bug with the Mono For Android product?
Go to Tools->Options->Mono for Android and turn on adb logging.
This should write a log to your desktop that might give more details.
Aha, thanks I've found the issue. There is a place in that dialog (Tools->Options->Mono For Android) that sets the Android SDK path. After doing this the solution deploys and works with no trouble. I thought I told the installer where the SDK was, but apparently not. Its possible I got myself confused as I'm evaluating the Eclipse/Android SDK development environment in parrallel.

Resources