Prototype/proof of concept of a "lite" Xamarin.Android that only supports Xamarin.Forms
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Prototype/proof of concept of a "lite" Xamarin.Android that only supports Xamarin.Forms.
DISCLAIMER: I created this project during Microsoft's #HackWeek 2018. It is not "a real thing" or endorsed/supported by Xamarin/Microsoft. If you would like it to be "a real thing", show your support! Star this Github repo, like the YouTube video, post on social media, comment, etc.! Every bit helps!
Download Xamarin.Android.Lite on NuGet
NOTE: in the video, I have
PATHexample on how to do this here.
The path to my MSBuild is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
Mac users can just run
msbuildand it works...
The easiest way to create a new project, is to use the Xamarin.Forms project template in Visual Studio. Just check one platform, use
NetStandard, and delete the platform-specific project.
NOTE: shared projects won't work (or make sense), Xamarin.Android.Lite is for NetStandard only
Edit your project file to look something like:
Remove the existingto Xamarin.Forms from the Xamarin.Forms project template, as Xamarin.Android.Lite is pinned to a specific version of Xamarin.Forms.
To run the app: - Launch the emulator, or connect an Android device via USB - Use the Android-specific MSBuild targets:
Details on each target: -
SignAndroidPackagedrops an APK file in
Installdeploys the APK to the connected device -
Runlaunches the main activity on the device
So, assuming the right
MSBuild.exeis in your path on Windows (Mac will "just work"):
msbuild MyApp.csproj /t:Run
This command gets you going!
Visit the MSBuild documentation for further details about MSBuild (project) properties.
Installtarget deploying to an emulator and device (Pixel 2). I deleted
msbuild /t:Restorebefore timing each test. On the
Second Install, I modified a XAML file and ran
Xamarin.Android.Lite - Emulator / First Install -
Time Elapsed 00:00:06.54- Emulator / Second Install -
Time Elapsed 00:00:03.01- Device / First Install -
Time Elapsed 00:00:05.60- Device / Second Install -
Time Elapsed 00:00:02.71
Xamarin.Android "proper" - Emulator / First Install -
Time Elapsed 00:00:49.46- Emulator / Second Install -
Time Elapsed 00:00:06.22- Device / First Install -
Time Elapsed 00:00:46.87- Device / Second Install -
Time Elapsed 00:00:05.95
NOTE: I compared this times on Windows with Visual Studio 15.7.5, using the default Xamarin.Forms Master Detail project template.
Mark Seeman on an episode of .NET Rocks talked about: "constraints liberate". I don't know if he originated the idea, but that is definitely what is happening here.
NetStandard2.0 projects only, Xamarin.Forms only
Mono.Android.dllor native APIs? Nope.
Xamarin.Android.Lite is bundled with Xamarin.Forms and Xamarin.Essentials to get the best APIs available for NetStandard.
If another library is deemed useful here, let me know--I could bundle it!
As noted in the project file above,is the way to go:
Then to load the image, you will need to use the following C#:
yourImage.Source = ImageSource.FromResource ("YourNameSpace.xamarin_logo.png", typeof (App));
Or better yet, make your own XAML markup extension to do this!
msbuild build.proj /t:Bootstrap msbuild build.proj