I am a .NET developer (more than 6 years now) and just starting to learn about mobile/smartphone/tablets development. Logically, I (and probably everybody else out there) would like the application we create to run on all smartphone platforms. It just feels natural from the normal user (layman) perspective that if it's a "mobile app" it should run on mobile device. It shouldn't matter if I own iPhone or Android, mobile app is a mobile app. Note: I am talking about native platform development, not HTML/web apps that can be used from browsers.
我是一个。net开发人员(6年以上),刚刚开始学习移动/智能手机/平板电脑的开发。从逻辑上讲,我(可能还有其他人)希望我们创建的应用程序能够在所有智能手机平台上运行。从普通用户(layman)的角度来看,如果它是一个“移动应用”,它应该在移动设备上运行。不管我是iPhone还是Android,移动应用都是一款移动应用。注意:我说的是原生平台开发,而不是浏览器可以使用的HTML/web应用。
So this is just a high-level overview question... what are the current strategies (in year 2013) to deal with this issue? The way I imagine mobile cross platform development works is there's probably a single common code base that implements app's business logic and then for each targeting platform we need to develop GUI part separately. How far is this from truth in practice?
这只是一个高层次的概述问题…当前(2013年)应对这一问题的策略是什么?我想象移动跨平台开发工作的方式是,可能有一个单一的通用代码库来实现应用程序的业务逻辑,然后对于每个目标平台,我们需要分别开发GUI部分。在实践中这与真理有多远?
Take for example the popular game "Angry Birds". I played it on iPhone, Android and even from Chrome browser on Windows Desktop (probably as Flash or HTML5 game) and each version had pretty much identical feeling when played. How did they do that? I imagine they have game engine as common code but in what language could it be written? As far as I know there is no common programming language that given the single source code files it can be compiled into native binaries for ios/android/win8 phone.
以流行的游戏“愤怒的小鸟”为例。我在iPhone、Android甚至Windows桌面的Chrome浏览器(可能是Flash或HTML5游戏)上都玩过,每个版本在玩的时候都有差不多的感觉。他们是怎么做到的?我想他们的游戏引擎是通用的,但是用什么语言写呢?据我所知,目前还没有一种通用的编程语言,可以将单个源代码文件编译成ios/android/win8手机的本地二进制文件。
3 个解决方案
#1
6
Unfortunately, there is no way to develop a cross-platform app which has really native look and feel and shares same code for all platforms. Its possible to share some code on some platforms though (for example, you can use C/C++ for iOS and Android), but only for the logic part of your app. To get native UI you will be forced to use native APIs. If your app doesn't involve some complicated data processing then this approach may have more downsides than really helping you out.
You can get rather good platform independence with hybrid app platforms such as PhoneGap or Titanium, but that involves HTML/Javascript development which could lead to a lot of time and efforts required to bring user experience to be somewhat similar to that of a native app.
不幸的是,没有办法开发一个真正具有原生外观的跨平台应用程序,并为所有平台共享相同的代码。虽然可以在某些平台上共享一些代码(例如,iOS和Android可以使用C/ c++),但只能在应用的逻辑部分共享。如果你的应用程序不涉及一些复杂的数据处理,那么这种方法可能比真正帮助你更有坏处。使用PhoneGap或Titanium等混合应用程序平台,您可以获得相当好的平*立性,但是这涉及到HTML/Javascript开发,这可能需要大量的时间和精力,以使用户体验与本地应用程序类似。
#2
3
Since you are a .NET Dev one logical solution for you would be to use Xamarin's offerings. (http://xamarin.com/) They allow you to develop your back-end logic once and then compile it into all three major mobile platforms (iPhone/Android/WP). You can then use this back-end logic project to write the UI layer for each specific platform.
既然你是一个。net开发人员,一个合理的解决方案就是使用Xamarin的产品。它们允许您开发一次后端逻辑,然后将其编译成所有三大移动平台(iPhone/Android/WP)。然后可以使用这个后端逻辑项目为每个特定平台编写UI层。
Another option that devs have is to use the javascript/html route similar to PhoneGap. While I haven't looked at this recently there used to be some performance hits and hardware usability gaps when going the JS/HTML route. This may have been improved now.
devs的另一个选项是使用类似于PhoneGap的javascript/html路径。虽然我最近还没有研究过这个问题,但是在使用JS/HTML的过程中,曾经出现过一些性能问题和硬件可用性问题。这一点现在可能已经得到了改善。
EDIT: Since you specifically mentioned games like Angry Birds. The Unity platform offers very good support for development that is compatible with most devices if you need 3D.
编辑:因为你特别提到了像《愤怒的小鸟》这样的游戏。Unity平台为开发提供了非常好的支持,如果您需要3D,可以与大多数设备兼容。
For Angry Birds specifically...they use Box2D for the Physics and I'm not 100%, but it looks like Cocos2d to draw the elements.
愤怒的小鸟特别…他们用Box2D表示物理,我不是100%,但看起来像是Cocos2d来画元素。
If you are looking to build games and like the idea of Xamarin then take a look at MonoGame which basically looks like an XNA port to the Mono Framework.
如果您希望构建游戏,并且喜欢Xamarin的想法,那么请查看一夫一妻制,它基本上看起来就像Mono框架的XNA端口。
#3
2
in addition of Jared's answer, this afternoon I tested Xamarin.
除了贾里德的答案,今天下午我还测试了沙玛林。
You are a .Net Developer and if you are already using Visual Studio, you are so lucky. Because Xamarin has an extension for Visual Studio
您是。net开发人员,如果您已经使用Visual Studio,那么您就非常幸运了。因为Xamarin有一个Visual Studio的扩展
I just want to give a bad impression about xamarin, you can test good ones by the time, user interface is created in a xml based file and there is no auto complete, so you have to write whole code or use properties window. But I think it will be better by the time. nice coding
我只是想给你一个关于xamarin的坏印象,你可以测试好的,用户界面是在一个基于xml的文件中创建的,没有自动完成,所以你必须写完整的代码或者使用属性窗口。但我认为到时候会更好。好的编码
#1
6
Unfortunately, there is no way to develop a cross-platform app which has really native look and feel and shares same code for all platforms. Its possible to share some code on some platforms though (for example, you can use C/C++ for iOS and Android), but only for the logic part of your app. To get native UI you will be forced to use native APIs. If your app doesn't involve some complicated data processing then this approach may have more downsides than really helping you out.
You can get rather good platform independence with hybrid app platforms such as PhoneGap or Titanium, but that involves HTML/Javascript development which could lead to a lot of time and efforts required to bring user experience to be somewhat similar to that of a native app.
不幸的是,没有办法开发一个真正具有原生外观的跨平台应用程序,并为所有平台共享相同的代码。虽然可以在某些平台上共享一些代码(例如,iOS和Android可以使用C/ c++),但只能在应用的逻辑部分共享。如果你的应用程序不涉及一些复杂的数据处理,那么这种方法可能比真正帮助你更有坏处。使用PhoneGap或Titanium等混合应用程序平台,您可以获得相当好的平*立性,但是这涉及到HTML/Javascript开发,这可能需要大量的时间和精力,以使用户体验与本地应用程序类似。
#2
3
Since you are a .NET Dev one logical solution for you would be to use Xamarin's offerings. (http://xamarin.com/) They allow you to develop your back-end logic once and then compile it into all three major mobile platforms (iPhone/Android/WP). You can then use this back-end logic project to write the UI layer for each specific platform.
既然你是一个。net开发人员,一个合理的解决方案就是使用Xamarin的产品。它们允许您开发一次后端逻辑,然后将其编译成所有三大移动平台(iPhone/Android/WP)。然后可以使用这个后端逻辑项目为每个特定平台编写UI层。
Another option that devs have is to use the javascript/html route similar to PhoneGap. While I haven't looked at this recently there used to be some performance hits and hardware usability gaps when going the JS/HTML route. This may have been improved now.
devs的另一个选项是使用类似于PhoneGap的javascript/html路径。虽然我最近还没有研究过这个问题,但是在使用JS/HTML的过程中,曾经出现过一些性能问题和硬件可用性问题。这一点现在可能已经得到了改善。
EDIT: Since you specifically mentioned games like Angry Birds. The Unity platform offers very good support for development that is compatible with most devices if you need 3D.
编辑:因为你特别提到了像《愤怒的小鸟》这样的游戏。Unity平台为开发提供了非常好的支持,如果您需要3D,可以与大多数设备兼容。
For Angry Birds specifically...they use Box2D for the Physics and I'm not 100%, but it looks like Cocos2d to draw the elements.
愤怒的小鸟特别…他们用Box2D表示物理,我不是100%,但看起来像是Cocos2d来画元素。
If you are looking to build games and like the idea of Xamarin then take a look at MonoGame which basically looks like an XNA port to the Mono Framework.
如果您希望构建游戏,并且喜欢Xamarin的想法,那么请查看一夫一妻制,它基本上看起来就像Mono框架的XNA端口。
#3
2
in addition of Jared's answer, this afternoon I tested Xamarin.
除了贾里德的答案,今天下午我还测试了沙玛林。
You are a .Net Developer and if you are already using Visual Studio, you are so lucky. Because Xamarin has an extension for Visual Studio
您是。net开发人员,如果您已经使用Visual Studio,那么您就非常幸运了。因为Xamarin有一个Visual Studio的扩展
I just want to give a bad impression about xamarin, you can test good ones by the time, user interface is created in a xml based file and there is no auto complete, so you have to write whole code or use properties window. But I think it will be better by the time. nice coding
我只是想给你一个关于xamarin的坏印象,你可以测试好的,用户界面是在一个基于xml的文件中创建的,没有自动完成,所以你必须写完整的代码或者使用属性窗口。但我认为到时候会更好。好的编码