Move from Xamarin to native(Swift/Kotlin)? - xamarin

We currently have an app in Xamarin, which is Xamarin.Android and Xamarin.iOS with a shared PCL (no Xamarin.Forms). It currently is a very complicated app and we would like to remake screen by screen the app, and move away from Xamarin to a Swift and a Kotlin app in the meantime.
Is this possible? We don't have the time nor money to remake the app completely at once.
I have looked into making new screens as external libraries, and then bind that library, but I think that's making it a bit too complicated.

you can reuse the assets and resources only but not the code because you are using Xamarin.Forms not Xamarin.Android + Xamarin.iOS.
in your project you don't have any android XML design files and no iOS storyboard even the logic is different with the .cs files because you are not using the Android Java SDK or iOS SDK directly.
If you were use mono and mono touch directly without using the PCL (Xamarin.Forms) project then you can rewrite the code with minor changes with names of method, properties... etc.

Related

Visual Studio App Center Android Build Project not finding Solution Files

I am trying out the new Visual Studio App Center for a mobile app I am writing.
I have three solutions checked into VSTS Git. The first solution named App.sln is a master solution that has 2 solution folders, Apps and Services. The Apps folder has 3 projects App.csproj which is a .NET Standard 2.0 library containing the Xamarin Forms shared code. App.iOS.csproj is the Xamarin Forms iOS project. Finally, App.Droid.csproj is the Xamarin Forms Android project. The Services folder contains project files written in ASP.NET Core 2. The second solution is a solution named App.iOS.sln containing just the iOS and App library projects. The last is a solution named App.Droid.sln containing just the Android and App library projects.
In App Center I have 2 Apps configured per the instructions for Xamarin Forms apps. The first is an App configured as iOS Xamarin app. The second App is configured as Android Xamarin app.
I configured the analytics and crash reporting which works. I then configured the builds and this is where I have run into an issue. Specifically the Android build configuration project drop down only sees the App.Droid project. The iOS App build configuration project drop down sees all three solutions but only the App.iOS project. I selected the App.Droid and App.iOS projects. It seems to work. However I'm concerned that in the future things might break. I rather select the App.iOS and App.Droid solutions. That way I know that the correct projects are compiled and nothing not need is compiled. This is especially true since I am trying to stay within the free compile time budget until the MVP is done. Any ideas how to accomplish ensuring only the right projects are compiled?
According to App Center team (on Jan 30, 2018):
Unfortunately we do not support the selection of sln's with Android
Xamarin, currently solution file is only supported for iOS.

Xamarin or Xamarin.Forms for Android and classic Windows?

Is there a way to create a Xamarin or Xamarin.Forms solution that targets Android and classic Windows to produce a Windows 7,8,8.1,10 executable (exe)?
I am not interested in UWP.
Xamarin.Forms will support WPF in the future so you will be able to deploy an EXE file to those platforms. Read more about it here on the blog.
Also, you can always share the business logic, data and other layers with any other .NET application so having an Android app, Windows app and a core project that doesn't depend on Xamarin is perfectly fine.
You can already take a look at the WPF branch of the Xamarin.Forms project on GitHub.

Xamarin project failing to find SkiaSharp in Android or Windows

I confess I'm new to Xamarin and cross-platform development, so apologies if this seems a trivial question, but I've been trying to get to the bottom of it for several evenings now.
I have a basic Xamarin Forms application, which runs in Windows 8.1, Windows UWP and Android. It uses SkiaSharp for some basic graphics (based on the Skia example).
It was running in all three platforms, but I had to remove and re-add the Xamarin packages to the project and I can't get SkiaSharp to run properly any more in Windows or Android. I get a BadImageFormatException:
Additional information: Could not load file or assembly 'SkiaSharp, Version=1.56.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
I get this exception in the x86, x64 and Any CPU configurations for the Windows 8.1 version, and from the Android version.
If I run it the UWP project, it works perfectly.
Relevant project structure:
MyProj.XMForms (Portable) - PCL containing the core Xamarin.Forms App, MainPage with a StackLayout containing a Frame with a MyView, and MyView which contains a Grid with an SKCanvasView.
MyProj.Windows (Windows 8.1) - wrapper - just contains an empty App and a MainPage which loads the MyProj.XMForms App.
MyProj.UWP (Universal Windows) - wrapper - just contains an empty App and a MainPage which loads the MyProj.XMForms App.
MyProj.Droid (Android) - wrapper - just contains a MainActivity which loads the MyProj.XMForms App.
All projects NuGet packages have Xamarin.Forms 2.3.3.180, SkiaSharp 1.56.0 and SkiaSharp.Views.Forms 1.56.0 . MyProj.Droid also has SkiaSharp.Views (none of the others will accept it).
I have discovered https://github.com/mono/SkiaSharp/issues/190 and added <ShouldIncludeNativeSkiaSharp>true</ShouldIncludeNativeSkiaSharp> to the csproj without making any difference.
I have tried removing and re-adding the SkiSharp NuGet packages.
What am I missing?
Thanks,
Ian
If you look at the exception message, there is this line:
Reference assemblies should not be loaded for execution.
That means you haven't installed the SkiaSharp NuGets into the app projects. Make sure all the apps have the SkiaSharp, SkiaSharp.Views and SkiaSharp.Views.Forms NuGets installed. The core project only needs the SkiaSharp and SkiaSharp.Views.Forms NuGets.
Also, Windows 8.x is not currently supported due to a limitation in Skia: https://github.com/mono/SkiaSharp/issues/20
Okay, I've managed to get Android working by taking the Android project from the SkiaSharp FormsSample and replacing the call to
LoadApplication(new SkiaSharpSample.FormsSample.Platform.App());
with
LoadApplication(new MyPortable.XamarinForms.App());
My original project definitely included all the same NuGets as this one, and I haven't yet identified they key difference which meant that this one worked and mine didn't, but at least I now have a solution which works in both Android and UWP.

Xamarin Cross Platform disable IOS

I'm new to Xamarin.
My goal is to develop an app for both Android and Windows phone platforms, without IOS. I dont have any mac to test.
Under the properties solution, I already tried to remove IOS from the targets platform, but doesn't allow me. It's mentioned that its
Thats the solution i tried withou sucess:
Remove ios, windows8, and wp8 from Xamarin Forms PCL - nuget 3.0 opt-into error?
Please help.
It doesn't really matter! It doesn't mean you are actually stuck with iOS in any way.
The only thing it means is that the set you have selected is also compatible with the libraries in Xamarin.iOS. So it means that you could create an iOS project without too much trouble if you would want to in the future.
If you do not create an iOS project, you won't get an iOS app.

Running exported Unity project in UnityPlayer initialized in Android Studio

Is it possible to run a Unity project, which uses TangoSDK, in the UnityPlayer created in an Android Studio project? Or is building and running a Unity Tango project directly from Unity the only option to create Unity projects for Android that use TangoSDK?
This is what I am doing step by step:
I have a basic Tango scene created in Unity.
I export it as Google Android Project in the Build Settings
I have a simple Android Studio project in which I initialize a UnityPlayer in the onCreate() method of the main activity.
I copy over the /assets and /libs folder from the exported Unity project to the Android Studio project. This copies all the necessary libraries and assets. I merge the AndroidManifest files so that they contain all the necessary permissions and point to the appropriate main activity.
When I build this project from Android Studio the Unity Player never launches (never goes past the Unity Logo screen).
I have tried the above steps with a simple Unity Projects that doesn't use TangoSDK and it worked just fine. I tried debugging the app and it appears that the problem is in the TangoService_connect() method that is being called from the library_tango_api library.
Has anyone tried this method of creating a Unity Tango app for Android before? I need to use a lot of Android API methods so I would like to make use of them on the Android's java side and then communicate with Unity via UnityPlayer.UnitySendMessage(). Or is using AndroidJavaObjects in Unity my only option?
Anton, Fisheye camera and front face camera are consuming a same channel on the hardware level, so you won't be able to use both of them. However, you will be able to use the depth/backfacing camera and front camera together..

Resources