简体   繁体   中英

What is the difference between Xamarin android project and Xamarin cross-platform project?

I'm really struggeling what project to open to create mobile apps.

Because I can choose in Visual studio for creating an android app, creating an IOS app and crossplatform app. So what would be the difference in those 3? Because if I select "android app" it will automatically use xamarin, but isn't xamarin for cross-platform apps?

I hope you guys can help me out with this one !

Xamarin allows you to create cross platform apps, which means your app will be able to turn on android, IOS & Windows Phones.

If you create a Xamarin Android project, it will only run on android.

Check this website for more info : https://university.xamarin.com/

Best regards

There are four project templates you can use for Xamarin:

1. Xamarin Android: With this project template, you can write an Android application based on C#. 在此输入图像描述 2. Xamarin iOS: With this project template, you can write an iOS application based on C#. 在此输入图像描述 3. Xamarin Cross-Platform (Native): With this project template, you can write an Android and an iOS application. (You have to create a view for each platform)

4. Xamarin Cross-Platform (Forms): If you need to write an application, only with basic functionality and you want to create only one view for all platforms, then "Xamarin Forms" is the best choice. 在此输入图像描述 在此输入图像描述 But to clarify, if you create a project with the cross-platform project template (3.), then you get a Visual Studio solution with three projects. Two of these projects are an Android project (1.) and an iOS project (2.), for specific code, and additionally there is a third project that you can use for writing cross-platform code.

If you want to create a cross-platform application, you have to choose between a "Shared Project" and a "Portable Class Library" , for the cross-platform code. The biggest difference between shared and portable is the usage of specific code. In a "Shared Project" , you use compiler directives to get a specific platform code, like iOS. In a "Portable Class Library" , you don't use the compiler directives. You only have to select a project, like the iOS project as start project and it works.

For more information about the difference between a "Shared" and "Portable" project look at this page .

A example of a native Cross-Platform application with a "Portable Class Library" : 在此输入图像描述

With Xamarin Cross-Platform, you can not only develop for Android and iOS, you can develop for Windows Phone as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM