How to cross compile a mobile SDK? - android

I have a sophisticated NLP engine that I wish to make available on mobile as an SDK for developers to use. The engine is currently a hybrid of multiple languages but we are looking to rationalise it to a single language and codebase. The answer to this question will influence the choice of language.
In particular, I wish for iOS developers to be able to call the engine using Objective C (Or perhaps Swift) and android developers to be able to use the engine in Java.
I do not want to port my engine and maintain two separate codebase for the core NLP algorithms.
While there are many options for cross compiling applications, such as Xamarin, Apportable, or even Phonegap. but none that I could see that would make it easy to cross compile an SDK.
What approach could I take so that my core engine is cross compiled from a unique code base while still providing good Java and Objective C bindings?

I do not want to port my engine and maintain two separate codebase for the core NLP algorithms
Then you need to write it in C or C++ and ensure that your code does not do anything platform-specific.
Then, you can write wrappers for it as needed, such as a JNI wrapper for use with the Android NDK, so Android developers can use your library via your wrapper's Java API.
I am not an iOS developer, and so I do not know what you might need to make a C/C++ library readily consumable via Objective-C (let alone Swift), though I imagine that there are some recipes for doing that.

Related

Using JNI FOR IOS and Android

Is it Reccommended to use JNI and C++ Code to make a shared library code between IOS and Android ?
I'am asking this because i think it not just saves us plenty of wasted time for implementing same logic in both platforms but also we will have the speed of a C++ core Backing the logic-process of our modules.
Update :
I ask my question in another way :
is it recommended to share a C++ Library for core functions of Android And IOS versions of a similar app ? or it would be better to completely migrate the codes to a multiplatform language ?
Since I remember my needs back then, I know that hybrid apps were not an option, Also JNI is not used for making cross-platform apps but the best use is to drive hardware peripherals via native UNIX scripts for Android or run c++ code on Android. So if we omit PhoneGap, Appcelerator, Ionic etc we will be facing several cross-platform technologies that have attracted many developer attentions so far.
Xamarin:
The framework was founded by the same people who have created Mono, an Ecma standard-compliant, .NET Framework-compatible set of tools. Xamarin offers developers a single C# codebase that can be used to produce native apps for all major mobile operating systems.
Unlike many other frameworks, Xamarin has already been used by over 1.4 million developers from around the world. Thanks to Xamarin for Visual Studio, developers can take advantage of the power of Microsoft Visual Studio and all its advanced features, including code completion, IntelliSense, and debugging of apps on a simulator or a device. Xamarin Test Cloud makes it possible to instantly test apps on 2,000 real devices in the cloud. This is by far the best way how to deal with the heavy fragmentation of the Android ecosystem and released bug-free apps that work without any major issues.
But being honest I didn't enjoy my first time face-to-face meeting with Xamarin. There were so many bugs and also speed and performance problems were bothering.
React Native
React Native is developed by Facebook and used by Instagram, Airbnb, Walmart, Tesla, Baidu, and many other Fortune 500 companies. It is an open-source version of Facebook’s React JavaScript framework. Because React Native uses the same UI building blocks as regular iOS and Android apps, it’s impossible to distinguish a React Native app from an app built using Objective-C or Java. As soon as you update the source code, you can see the changes instantly manifest in an app preview window. Should you ever feel the urge to manually optimize certain parts of your application, React Native lets you combine native code with components written in Objective-C, Java, or Swift.
The ones I mentioned above are not the only options, but since now they are the most used frameworks between programmers. But beware that Flutter is being publicly announced by Google in Google IO and maybe it may be going to create a hit soon.

Why should I use portable class libraries with Xamarin?

I am currently evaluating Xamarin for my company with the goal to develop iOS and later on maybe Android applications. (Windows Phone or Windows store apps are not a concern for us). We are thinking of putting shared functionality into a common library and according to the Xamarin Docs PCLs are the way to go. However why can’t I just create normal .net class libraries and reference against them?
Mono serves as the base for Xamarin and has in most areas a quite mature implementation of .net Framework which should be both available on Android and on iOS since it is part of Xamarin.
Am I missing some important fact or are PCLs only needed when I also want to develop Windows Store applications?
Regular .NET libraries support a single target framework. The .NET framework used by Xamarin iOS is not the same as the one used by Xamarin Android, or Windows Phone, etc. They all use different subsets and variations of the "full" framework. So a dll compiled against one flavor of the framework will not work with a different target.
PCLs avoid this by allowing you to target multiple frameworks and use the intersection of functions that they all support.
PCLs are one of the two ways of sharing code between platform-specific projects in Xamarin (the other being Shared Projects). They allow you to target multiple platforms, but you end up working with a smaller set of assemblies.

Cross platform mobile frameworks with native code support

I'm looking for a list of cross platform framework which have support for building native libraries in C++. Most of my legacy code base is written in C++, and I'd like to deploy my applications with the native code on the phone instead of using a client/server model. Wrapping it with networking will introduce latency, reduce performance, and degrade the user experience.
I've looked at some of the basic ones like PhoneGap and Titanium, but I can't from their websites if they support native, or how well they support it. I've looked at JUCE which is a C++ framaework, but it's not clear how mature it is.
what i've found so far
Juce: open source, small
Moai: buggy documentation
Marmalade: stable, mature
wxWidgets: beta only
update
A couple of years later, and it looks like Qt has gotten to the point where it may be the top contender. Other platforms which have matured in that time include Unity, and Embarcadero.
Check MoSync, you can build mobile applications with C, C++, HTML5, JavaScript. Check their website to find bunch of technical information.

Building android app

hey guys, i am researching android app development, and i cant find much on building an app in C or C++, so my question is, is it possible to build an android app using only C or C++ ?
Yes, in the most recent versions of the NDK they've announced such a capability. Before that, you could have an app that's a thin layer of Java on top of a C/C++ NDK core.
The majority of the run-time library is still Java-based, and accessing it from C++ is not exactly straightforward. JNI exposes the Java world to C/C++ callers, but it does not look pretty.
You might consider one of the other cross-platform services (e.g. MoSync), but realize that they are also limited in the sense that they give you access to more generic language features. Advanced or new features, such as NFC are not yet supported. Further, if you are planning on deploying the app commercially, you may have to pay them a royalty. You can get a better amount of information at their site.
Sure, using the Android Native Developers Kit.

Complete Way to Compile Complex Native Applications to Android ARM

This is my first S/O question, please be gentle!
I'd like to know more about porting C applications to native ARM for use on Android devices.
I can make simple programs using the prebuild toolchain which comes with the source, but how can I use this toolchain with applications which are more than one file and require configure and make?
This article explains it quite well:
http://davanum.wordpress.com/2007/12/09/android-invoke-jni-based-methods-bridging-cc-and-java/
Basically, you create a shared library like you normally do, wrap it with JNI and call it with native methods from Java.
At Google I/O they talked about introducing an "NDK" -- native development kit -- that should simplify the process of creating applications that use native (C) code.
It's worth noting a couple of things before you go too far down this route:
The NDK will provide limited functionality. It will be primarily intended to offer a way to run extremely time-sensitive code natively, but won't have access to the full system, nor will it provide an alternative application development model (you'll still need to write most of your app for Dalvik).
You can write native apps without the NDK, but you won't be able to distribute them to end-users using the conventional APK application package supported by the app store. It's really only a viable option if your app is being distributed as part of the carrier / OEM build - and even then isn't recommended.

Categories

Resources