I am new to Xamarin and would love to build our Android mobile solution with Xamarin, given our .NET expertise. I am interested to know if there are any performance issues or limitations we should be aware off, before we dive deeper. There are a lot of comparison for native (Java/Kotlin) development with ReactNative, Ionic etc, but not much with Xamarin, specially for Android.
This question does not really has a specific answer, it is a subject to debate. To answer it briefly, there is no important limitations to using Xamarin for mobile apps. It has advantages and drawbacks, and the best way to learn the is to try it.
Since Xamarin is very close to the native platforms, you won't lack any hardware access, which is a good point for a mobile framework.
In terms of performances, this article gives valuable input, like several interesting benchmarks opposing Xamarin and the native solutions.
The same site also has another article givin more details on how to chose one or another.
From my point of view, Xamarin is a safe solution. We've been using it for 3 years now for various customers, some of them asking for very specific designs, and we never had any issue with it. It is more a matter of personal preference.
There is already a question similiar too your's, see the next link:
Does anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?
Related
I'm a web developer and am thinking of digging into mobile app development. The languages I know so far are PHP, Python, SQL, Js, HTML and CSS, all of them pretty well now. Currently I'm starting to dig into Java, as it's the language to be used for native Android App Development, as far as I've learned. Interestingly, I'm coming across posts (also in this forum) saying that Java can also be used to develop iOS - compatible Apps, while other sources comment that Apple is completely against cross-devs, and that you should develop iOS apps using Swift when it comes to the native choice and optimal UX. So I was wondering about the answer in this forum; can you develop iOS apps using Java or not?
Post is a few months old now, but I figure someone with a similar question will probably find this with web search, so this reply is for them. (Disclaimer: I wrote Java professionally for about five years, and I grew up when Java was supposed to be the future.)
If the question is, "Can you write Java code and run it on iOS?" then the answer is, "Technically yes, but you almost certainly don't want to."
It requires jumping through all kinds of hoops and sleight-of-hand to make it work. The project linked in a previous answer, Codename One, is a pretty heavyweight framework and the kind of thing you'd only want to use if you were heavily committed to a Java codebase already.
There are advantages to knowing Java in 2022, but cross-platform mobile development isn't one of them.
Some reasons why you might want to learn Java:
Developing on Android. Android now supports/recommends Kotlin for new projects, but Java was the sole first-class language on the platform for 10+ years, so it's advantageous to be able to read/write/reuse Java code and libraries.
Using long-standing big-data tools (spark, hadoop, neo4j, etc.). While this domain has increasingly moved to Python over the past 5-7 years, there's still a lot of production Java code that someone needs to maintain. [Edit 3/31/22: See also the Apache http server, whose name never sat right with me because as far as I know, the people who wrote it aren't Apache.]
Stylistic similarity to C-family languages. Java can be a more intuitive introduction to C-style languages than jumping right into, say C++. These days, though, I would recommend C# over Java since it's used in more domains.
Continuity with some JS dialects. React code in particular is full of Object Oriented(tm) design conventions that are very strongly influenced by Java practices, and those design choices in turn have influenced changes in the JS spec. So being familiar with Java conventions can help make sense of that stuff. It can also help you identify which of those practices are bad ideas so you can avoid them in JS. [See footnote 1.]
As far as reasons why you won't see widespread Java usage outside of those legacy domains, I'd say there are a lot of good reasons people have moved away from Java since 2006 or so:
It's incredibly verbose, and requires a lot of esoteric knowledge about implementation details to write code that runs efficiently. This is the kind of problem that languages like Scala and Kotlin have tried to solve, while retaining compatibility with the JVM platform for ease of migration.
The JVM platform itself introduces substantial overhead, both in resource usage and integration complexity.
Changes in approach and policy since Sun's acquisition by Oracle. This is related to licensing issues (see Oracle v Google), as well as complexity/feature creep, which has given rise to compatibility issues across codebases.
Emergence of viable alternative languages in the 2000's and 2010's.
Widespread adoption of virtualization technology has yielded alternate ways to solve the compatibility issues that Java was designed to address.
It's ironic, since the motto of Java used to be "write once, run everywhere", but that's the way things go.
Footnote 1. Actually, this is kind of a trick question, since most commonly accepted Java practices are bad ideas. This can be demonstrated by the fact that in 1995, object-oriented Java applications would run in a typical web browser, whereas 27 years later Java is considered too heavyweight for that purpose.
Postscript, 3/31/22: This is my first and likely only Stack Overflow post. If you want to read more like this, check out my github: https://github.com/ubuvoid
Yes you can.
One tool used for this is Codename One.
https://www.codenameone.com/
Also for more info on this subject, feel free to consult this thread:
How can one develop iPhone apps in Java?
Yes, this is possible. https://github.com/Anuken/Mindustry is an open-source RTS game written in Java. It has an iOS port that is compiled via an open-source fork of RoboVM.
IOS works on objective C and Android works in Java and Kotlin. I don't know how much some conversion tool can help you to achieve all the functionality. So in my opinion answer is No.
Hybrid Application development can help you. You have one source code that will run in both platform. You have to develop the app again.
First: Java is used in more Domains than C#. Needed information because C# has no way to get over with ONE UI to Desktop, Mobile and Web.
By the way, the recommended Solution is CodenameOne or - if you want to implement your App with JavaFX - use Gluonmobile which is using the GraalVM, an ahead of time compiler for IOS.
In both Cases you have access to Hardware of the Device for Android and IOS because there is an abstraction which helps you with implementations for both Platforms - Android And IOS. Write in this Case one App and compile for both worlds.
I am very new to React-Native and love it so far. Really great technology and very impressive tooling. I would like to propose it for use in my company.
However ... react-native examples demoing code-sharing btw Android and IOS platform are simply nowhere to find??? All I have found after 3-4 weeks looking into it is few excellent but only IOS examples. Below, are just few examples of articles lacking this. Although some of them claim in their title to cover both, they cover only IOS:
https://www.raywenderlich.com/165140/react-native-tutorial-building-ios-android-apps-javascript
https://mentormate.com/blog/react-native-components/
http://www.andevcon.com/news/take-a-crack-at-react-native-with-kyle-banks
https://appendto.com/2016/11/build-a-coffee-finder-app-with-react-native-and-the-yelp-api/
https://reactjs.co/react-native-convention/
https://www.lullabot.com/articles/build-native-ios-and-android-apps-with-react-native
https://code.facebook.com/posts/1189117404435352/react-native-for-android-how-we-built-the-first-cross-platform-react-native-app/
https://medium.com/#MentorMate/best-practices-for-building-an-app-with-react-native-components-7dee3b2b010f
https://code.tutsplus.com/tutorials/creating-a-dictionary-app-using-react-native-for-android--cms-24969
http://facebook.github.io/react-native/docs/tutorial.html
... , this list could continue on and on but it should be enough to demonstrate the lack of good resources I'm talking about.
I understand react-native is cross platform in terms that you can write code for both Android and IOS, that is all clear and great.
But is it sharing the code? In other words, is it DRY? From what I see, it is write once for each platform rather than write once for all platforms. Again, I understand some Views (but not all) are platform specific but again, there is no example to show even that on both Android and IOS in the same project.
Where is a non-hello-world (real life) example to clearly demonstrates and teaches how to do that? React native used to have it in version 0.20 or so but it was removed and replaced with a HelloWorld example? Seriously #Facebook???
As per links above, lots of React-Native articles out-there are titled to cover both platforms but then they only talk about IOS without even mentioning any other platform? Very few talk about Android only, again, not even touching other platform in the same project. ... and lots of them are outdated!
I understand that the technology is very new (and very good from what I have seen so far, I really love it).
But assuming I have to propose React-Native as a next-gen platform to a company, I do not see any convincing cross-platform, code-sharing examples demoing this for both Android, IOS (UWP??) that I could help me learn, understand, build, and demo an example for that proposal.
I am not looking for chatty comments or links to courses but rather examples to show how to do this in more than just CRNA generated HelloWorld app.
Found the answer here https://www.codementor.io/vijayst/build-react-native-retrofitting-ios-app-to-android-gsf5uyl1q in the very 1st paragraph and it is exactly what I have been trying to get RN/Facebook answer but they ignored the question all the time.
Very disappointing!
So, ReactNative is not "build-once-use-everywhere" but rather "learn-once-use-everywhere" meaning lots of code duplication. And by everywhere, they mostly mean Android and IOS although the examples out-there are mainly IOS. If they cover both platforms, then it is with almost no code sharing but lots of code-duplication.
Although, RN claims they can achieve up to 90% of code sharing, that is not demonstrated anywhere that I could find. Documentation is very shallow in touching anything let alone topic of code-sharing and the tutorial provided by RN is a HelloWorld, ... yes, seriously. Sad! Although they used to have a better tutorial in older version (like 0.20 or so).
In terms of recommending RN to a company as a next-gen platform, I see few issues
concerning patent license, no answers no explanations, very obscure and concerning for a company that would consider moving to this, I'd rather say open-source under quotation marks. Hopefully this will change as I see it as a mayor showstopper for anyone considering adapting this technology. I would say this is no more applicable as FB made react-native licensed using MIT as per https://github.com/facebook/react-native/issues/16079
documentation that is very basic without giving depth of explanation. For example, this is react-native site with demo sample to demonstrate code-sharing cross-platform nature (I warn you, it is a HelloWorld example) https://facebook.github.io/react-native/docs/tutorial.html
React Native Community facebook page which is the page where you are supposed to find help and ask question as per react-native site will simply block you if you bring this topic on and will not let you in
even here on SO, questions like this (after extremely thorough and time consuming research) will earn you only downgrades and zero answers or even attempts
examples lack clarity and depth of explanation, it seem like whole community follow one pattern, copy / paste demonstrating code-duplication rather than code-sharing
Most examples cover (to most basic extent) only IOS although most claim cross-platform nature on both Android and IOS with Android being mentioned in the title only and the body covering only IOS
Impossible to ask for help on react-native site
Impossible to suggest improvement on react-native site other than create pull request. In other words, they want you to work for them for free
The framework is cross-platform, that is great but it is more of a copy/paste (copy from IOS into Android, then modify what needs modification) rather than code-sharing strategy. Every example I was able to find and it took me a month, was a violation of DRY principle in its best form
Although I mentioned things that bothered me at most during my research, I have to say that I hope this technology will thrive and become clear open source platform in future. I really like it and hope someone at #Facebook / #ReactNative will consider these suggestions, or at least provide improvements in the documentation, examples, access to community, place to ask questions and get help, clear licensing, ... all of which I was not able to get after spending a month researching RN.
Perhaps the technology is still not mature enough, which makes sense, it is very new.
Would I recommend it?
To developers yes, definitely. I really like it myself and will spend more time studying it.
To a company? Not really for the reason explained above.
UPDATES - Getting Better :):
... and to add my 2c to anyone who faced the same problem and contribute to community (at least in terms of finding tutorials that talk about both IOS and Android), I will keep posting links I have managed to find so far:
https://differential.com/insights/sharing-code-between-android-and-ios-in-react-native/ is very basic example. Not really code sharing but rather code duplication but at least something
https://www.codementor.io/vijayst/build-react-native-retrofitting-ios-app-to-android-gsf5uyl1q, also more of a code copying rather than code sharing but hey... going somewhere
https://hackernoon.com/getting-started-with-react-navigation-the-navigation-solution-for-react-native-ea3f4bd786a4 another good one
This document explains that RN philosophy is "learn once, write anywhere" rather than "write once, run anywhere" http://makeitopen.com/tutorials/building-the-f8-app/design/
I have trouble finding the apt title for this question, but basically I was wondering if anyone in the community can recommend me a resource that compares similar aspects of iOS programming with Android. The reason being, is that I am currently an iOS developer, and it will help in my learning of Android faster if I can understand similar conventions in Android.
For example, I have realized that Activity in Android works very similarly to View Controllers in iOS. Another example would be onCreate in Android seems to work similarly to viewDidLoad in iOS.
Are there any websites that provides this comparison? I've search extensively on Google but only found generic search results pertaining to the competition between the rival platforms.
I apologize in advance if this is the wrong community to post this question.
This book might help:
Migrating to Android for iOS Developers
Though I haven't read it myself, and it is still in alpha.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am the only mobile developer in my job. Before I was hired, my currently boss was thinking on using Xamarin as their marketing says the words Shared code and native.
I consider myself an advanced Android developer since I've build large information systems. Right now I'm working on simple apps I could finish in a week, but Xamarin is giving me headache since its too buggy, and the reusable code is about 10% that could easily be copy/pasted into iOS, and despite the fact that you can share that 10% code, sometimes you still have to use compilation directives #if / #endif.
I mean, there is no really any advantage for me, since I already know both Java and Objective-C languages. I already have vast knowledge of SQLite and data storage with Core Dataon both iOS and Android SDK so that learning Xamarin will make it slower.
I have already tried to talk them into not going for Xamarin since its only a little code you can share, but they don't seem either to understand.
I need some good argument to convince them not to buy it, so I can do my job in a more productive and faster way. Thank you in advance.
Some good points from Lee Whitney's Blog: Why I Don’t Recommend Xamarin for Mobile Development:
App Overhead
Xamarin based apps have a built in overhead that makes them larger on
average. This affects download time and storage used on a device.
The minimum additional size is usually a few megabytes and can grow
proportionately as the code uses more of the APIs. This is due to the
way code from .NET assemblies is statically linked (as native code)
into apps as the assemblies are referenced. On Android there is also
an extra startup delay for apps for OS specific reasons. To
Xamarin’s credit this overhead used to be much greater and the company
has made great strides in reducing it. However, the impact on app
users is still measureable.
Limited Sharing of UI Code Across iOS and Android
User Interface development is not portable between iOS and Android.
This means APIs, event logic, widgets, and designers must be used and
coded differently for each platform. There are a few exceptions to
this for common, low level operations.
Xamarin would argue that trying to abstract UI APIs across very
different platforms can create unnecessary complexity or lead to a
poor user experience with an LCD (lowest common denominator) design.
They have a point here. Titanium tries to do this partially, and the
result has made many developers unhappy with the inconsistent or
unpredictable results. HTML5 apps are more successful at pulling off
this UI abstraction without forcing an LCD design, but they do not
have the native performance of Xamarin.
UI problems can be some of the most time consuming aspects of
developing mobile apps. Despite having a good justification, the
important takeaway is that for many mobile UI problems, Xamarin will
not save developers or designers time.
Limited Sharing of Code Outside of Xamarin
Xamarin does not allow creation of reusable components or modules
outside of it’s own environment. For example, code written in Xamarin
cannot be used in native or HTML5 apps. This means any code developed
by a team using Xamarin cannot be shared or reused with teams using
any other tooling for iOS and Android. How much this matters depends
on the situation, but the problem with development is we can’t predict
all of our situations. So it’s an uncomfortable limitation to have
right out of the gate.
Ecosystem and Community
This is something that is not really Xamarin’s fault. What company
has a mobile ecosystem that matches Apple, Google, or HTML5? However,
it matters. When developers are 10 times more likely to find results
when searching the web about an issue, it directly impacts
productivity. The ecosystem of available support, services, and 3rd
party components, and related tooling is, and will continue to be,
significantly smaller than for native or HTML5 based apps.
The Third Learning Curve
Some concepts and techniques require special knowledge specific to the
Xamarin environment. This effectively adds a third learning curve for
developers beyond programming language and native APIs. For example,
developers having to understand iOS reference counting to avoid
problems with Xamarin’s garbage collection
(Is this a bug in MonoTouch GC?).
Another example is data structures and generics working in subtly
different ways
(http://docs.xamarin.com/guides/ios/advanced_topics/limitations).
These are the types of issues that are hard to see before you actually
adopt a new platform, so they merit special consideration.
More Moving Parts
Xamarin introduces it’s own set of bugs that affect product quality
and developer productivity. The problem is not that Xamarin has a
bad product, but that adding any large or complex system to the app
toolchain comes with problems and bugs that do not exist in native
apps.
The historical record of these bugs can be reviewed using Xamarin’s
bug tracker (https://bugzilla.xamarin.com).
Yes, all software has bugs. The point is when you measure the
advantage of adding new tools; the disadvantage of new problems must
be factored in.
Summary
In the end we have to try and quantify the benefits of a development
abstraction like Xamarin over other abstractions, or over native
development. Is C# better than Objective-C? Yes, by far in my
opinion, but that’s only one factor. When you add everything up it
tips the scales away from Xamarin in favor of other approaches to
mobile development. As of 2013 (this stuff can change quickly) I tend
to choose a native code solution or an HTML5/Cordova solution. I like
both for different reasons and will try to explain some of the
decision factors in another article.
I have to develop an android application that use geolocation, and I am confused to choose between web framework mobile and native Android application, and if I must to choose a web frawework which one do you recommend to me?
Actually there are many kinds of framework : like JQuery mobile , Phonegap , titanium , Windev for mobilephones
Regarding the firs part of your question, I'd say this depends on a couple of factors:
1.) Previous experience: Do you already possess experience working with HTML/CSS + JQuery or do you possess experience working with Java? If your answer is yes to the first part: go for web framework development. If your answer is yes to the second part (Java): go for native app development, trust me, it's really easy to pick up if you have already worked with Java before and possess basic knowledge about inheritance and working with packages etc., also, start with the tutorials on developer.android.com If your answer is no to both parts of that question then I'd suggest you go with native app development since picking up Java is relatively easier compared to HTML/CSS+Javascript, in my opinion. If your answer is yes to both parts of the question (i.e you've worked with both Java and HTML/CSS+JS) then look at point 2.
2.) Personal Preference: Clearly, you don't have one right now so just go with what feels easier.
3.) For a geolocation app I'd say native app development is easier, I've been working on a geolocation based app for a while now and I felt that using the Google Maps API was pretty easy and you'll also find significant amounts of help from stackoverflow since everyone and their mothers have tried to make a geolocation-based app. I found the answers to most of my problems here on SO.
If you need more suggestions on this matter don't hesitate from asking!