I am trying to digest the following information from Flutter site.
How does Flutter run my code on Android?
The engine’s C and C++ code are compiled with Android’s NDK. The Dart
code (both the SDK’s and yours) are ahead-of-time (AOT) compiled into
native, ARM, and x86 libraries. Those libraries are included in a
“runner” Android project, and the whole thing is built into an APK.
When launched, the app loads the Flutter library. Any rendering,
input, or event handling, and so on, is delegated to the compiled
Flutter and app code. This is similar to the way many game engines
work.
Is each Flutter app (more precisely each Android app that is created with Flutter) published with Flutter engine attached?
Yes, it is included in every app. There is no code sharing between apps on Android/iOS. Also each app could have a different version of the engine (depending on when it was compiled)
Note that the with the upcoming Flutter 1.0, the overhead (on Android) is less than 5M, which is not bad. I believe the overhead is similar on iOS.
libflutter.so is 27.1MB on my emulator for each of a full / production app and a hello world app.
Related
Could anyone please explain behind the scenes of the flutter determines written code is for android or ios.
Dart is ahead-of-time (AOT) compiled into fast native X86 or ARM code for Android and iOS devices. Flutter can also call out to Android and use Android features only available in Java (same with iOS). Flutter is written in DART so we can't call that it compiles but DART does and it's rendering engine does.
Flutter Framework provides all widgets and packages whereas Flutter SDK allows you to build apps for android and IOS
The engine’s C/C++code is compiled with Android’s NDK or iOS’ LLVM. Both pieces are wrapped in a “runner” Android and iOS project, resulting in an apk or ipa file respectively. On app launch, any rendering, input, or event is delegated to the compiled Flutter engine and app code.
I thought images would be much clear instead of writing many things.
More of these:
https://docs.flutter.dev/resources/faq#run-android
Can you publish an app made with android studio to iOS platforms? Is there a compiler that lets you compile your Android Studio app to and iOS platform working app?
It is not practical to run Android apps on iOS or the other way round.
Each operating system of each platform has different native components. The native Android or iOS app development requires using different programming languages, design interface, navigation, integration process.
The Android system uses the instruction set of the Java virtual machine called ByteCode. iOS, on the other hand, implements the compiled code.
Running Android apps on iOS is not possible because of the following factors:
Different lifecycle of apps in the system.
Different lifecycle of app screens within the app itself.
Different approaches regarding data access.
It is misleading to be told to use some kind of service or program to transfer your app to another platform with just a few clicks. Online tools like an Android to iOS converter do not work.
The only exception is the case if your app has been developed cross-platform from the beginning. There are some web-based libraries and frameworks which can help you develop hybrid apps. You can also have a look at flutter & xamarin but the app must be all done in that framework.
As far as I know, there is no something that can do that. Android is very different from IOS. If you want, there are a lot of tools that you can develop with them apps for both Android and IOS, with one codebase.
Some of these tools:
React Native
Flutter
Xamarin
PhoneGap
Apache Cordova
But if you will use one of these tools, instead of Android Studio for Android and XCode - It will not have the same performance as if it was written with Android Studio and XCode.
The reason for that is because the platform-specific tool (Android Studio / XCode) can talk directly with the Operating System, while the cross-platform tool (React Native / Fultter etc.), cannot talk directly with the Operating System.
Hope I helped you!
You can do this with Flutter.
https://flutter.dev/
They are different from writing standard android apps, and use Dart rather than Kotlin/Java.
It does have a good tight integration with Android Studio however.
I can't find any concrete resources on this, does Dart get compiled to JVM, or did the Google's team compile the Dart VM to be run on the JVM and then run Dart inside Dart VM inside JVM?
The former makes more sense and it goes inline with the "no bridge" mantra, but the latter seems more inline with how integration between native & flutter code looks like
Dart is compiled to native machine code (ARM, Intel, ...) executable and bundled with some native platform code (Java, Kotlin, Objective-C/Swift) to interact with the native platform.
See also
How does Flutter run my code on Android? The engine’s C and C++ code
are compiled with Android’s NDK. The Dart code (both the SDK’s and
yours) are ahead-of-time (AOT) compiled into a native, ARM library.
That library is included in a “runner” Android project, and the whole
thing is built into an APK. When launched, the app loads the Flutter
library. Any rendering, input or event handling, and so on, are
delegated to the compiled Flutter and app code. This is similar to the
way many game engines work.
Debug mode builds use a virtual machine (VM) to run Dart code (hence
the “debug” banner they show to remind people that they’re slightly
slower) in order to enable stateful hot reload.
How does Flutter run my code on iOS? The engine’s C and C++ code are
compiled with LLVM. The Dart code (both the SDK’s and yours) are
ahead-of-time (AOT) compiled into a native, ARM library. That library
is included in a “runner” iOS project, and the whole thing is built
into an .ipa. When launched, the app loads the Flutter library. Any
rendering, input or event handling, and so on, are delegated to the
compiled Flutter and app code. This is similar to the way many game
engines work.
Debug mode builds use a virtual machine (VM) to run Dart code (hence
the “debug” banner they show to remind people that they’re slightly
slower) in order to enable stateful hot reload.
https://flutter.io/docs/resources/faq#how-does-flutter-run-my-code-on-android
See also https://proandroiddev.com/flutters-compilation-patterns-24e139d14177
Sometimes you find the answer immediately after you ask it -_- Found this reddit answer
Both!
When developing, Flutter uses the VM so you can get nice things such
hot reloading.But for production it compiles down (AOT) to a native
ARM library then uses NDK on Android and LLVM on iOS to embed on
native apps (runners).
That is why you get a debug/slow mode banner on the top-right corner,
to remember you that, you are using the VM.
Check https://flutter.io/faq/#technology
Also https://www.youtube.com/watch?v=FUxV4MIhS3g
P.S. This doesn't mean that Dart VM isn't suitable for production
environments, you can still use it on server-side or long-running
tasks, just like JVM, CRL, Node.js etc. I'm personally using it for a
HTTP API and really enjoying it.
The recently launched react native features just iOS app example and docs.
Yes.
React Native for Android was released September 14th, 2015.
Docs: http://facebook.github.io/react-native/
No. You can't build Android apps with this release.
Facebook has indicated that they are working on an Android version, and famously said "give us 6 months", which some people have taken as a promise. I wouldn't base any important business decisions on the illusion that it will be unveiled when the 6 months is over, but you can at least take some hope in the fact that they're serious about making it production-ready before they give us access to it, and that it's not just a pie-in-the-sky hope.
Also, as others have pointed out, Facebook has already release apps that they've built with the Android version of React Native. So at least parts of it are ready for prime time.
UPDATE
Early support for React Native for Android has been pushed to GitHub!
As noted, there are several things that are currently not working if trying to port an application from iOS. But it's worth checking out.
https://github.com/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be
It is not aiming to be a cross platform, write-once run-anywhere, tool. It is aiming to be learn-once write-anywhere. -Colin Eberhardt, from Raywenderlich
Good news is that React Native for Android is finally here. (https://code.facebook.com/posts/1189117404435352)
while you can't do it right now, it shouldn't take that long.
The first React Native Android App has been published about two weeks ago in the play store as tweeted by the reactjs twitter account:
https://twitter.com/reactjs/status/615638361328349185
Great news! Now its possible!
"And so it happens, the commit we're waiting since about 6 months!" - usereact.com
Please read more on: http://www.reactnative.com/react-native-for-android/
Watch this video: https://www.youtube.com/watch?v=MNNR01NF290
I've tried out Facebook react native on Android and it really worked.
Simple Ubuntu install guide can be found here
Simple js files: link
Yes , We can now developed android apps too in react-native.
and some of the apps are already developed in react-native for android
suchs as:
1)F8
2)Facebook ads manager
3)Squad
4)Discovery VR
5)Ziliun etc..
and many more still counting.
Developers from around the world now opting react-native for mobile app development because of easy of use of JSX syntax.
and also it is commonly noted as simply the V in MVC.
Since React makes no assumptions about the rest of your technology stack, it's easily embeddable within an existing non-React Native app.
TLDR; Yes,
Detailed answer (As of November 2017)
React Native android application development is very stable and a good number of Android applications have been already built and used in production using React-Native.
You can find a showcase of applications here. Most of them have both IOS and Android versions.
You can also easily integrate your native Android java code to react-native. Refer here
As a developer who is building Android app using react-native with a lot of native java code dependencies, react-native runs stable and I found the documentation and community support is adequate.
Yes, it works for both the platforms ios and android, be sure to mention code entry points in app.js if it uses different code for different platforms. However native functions like native events or location manager need to be coded in native languages and then exported using RCT_EXPORT, you can find more about it in the docs
Sure,
Using React Native you can build real mobile app. real app means close to platform or simply can say 99% native app.react native provide easy way for building native android app using javascript for lucrative design.You have basic knowledge of android studio and error fixing in android studio related native module integration and good understanding of react.js then you can build android app using react native.
Basic Requirement for android app
1. Configure android studio please follow below link and avoid installation of python.
https://facebook.github.io/react-native/docs/getting-started .
2. for UI you will learn flex-box from official documentation.
I thing that is enough
Yes, not just with android but also with iOS using XCode
Yes, you can make real-world mob application with React-Native. React-Native is used to create a hybrid mobile application. In this, we write code in javascript which gets converted to swift for ios and java for android.
Yes, You can build the Android app using React Native. For this, you have to install Android Studio with all the required SDKs. You can run your React Native app in Android simulator by using Android Studio and command line both.
For command line, run the following command:
react-native run-android
Otherwise you can open the android project in Android Studio which is created by React Native in android folder and run the project from there.
Happy Coding.. :)
Yes, you can definitely build android apps using react-native.This is one of the great benefits of React Native. Before Facebook created it, you had to build your app twice and with different code : one for iOS using Swift or Objective-C and one for Android using Java or Kotlin.
Being a newbie to phonegap development I have question for which i have not been able to find the answer yet. I have developed an using Xcode and phonegap. I used the IOS simulator and my iphone as a test device. After getting the development certificate, I could install the app using Xcode on my phone to test the app. I also submitted the app to the app store via Xcode.
I obviously want to deploy my app on other platforms like the android and windows. I know I can submit the app to phonegap build and it returns me all the executable files for different platforms.
But, instead of developing the app for IOS, if I had developed the app for android, I assume that phonegap build will give me a .ipa file.
How can I submit the app developed for android using phonegap submitted to the apple store for distribution.
Thanks for your help in advance.
Great question. I think the heart of this question lies at the differences between PhoneGap and Cordova. Cordova is sometimes thought of as the Open Source version of PhoneGap, but in reality, Cordova is the Open Source core of PhoneGap.
What does this have to do with PhoneGap Build? I'm getting there. When Adobe wanted to Open Source PhoneGap, they wanted to keep the branding for a few value added features that they could monetize. The Apache foundation had them rebrand the open source version, which is now known as Cordova, and Adobe retained the rights to use PhoneGap for their value added features, one of which is PhoneGap build. The PhoneGap Build FAQ might be useful info.
But, instead of developing the app for IOS, if I had developed the app for android, I assume that phonegap build will give me a .ipa file.
Actually, no. When you're developing with XCode for iOS, XCode itself produces the .ipa based on the Cordova (PhoneGap) template project. If you were to build for Android for instance, you would produce a .apk, which is, more or less, the Android equivalent of a .ipa. If you were to develop for Windows phone, you would produce a .xap file. The one problem with you doing this yourself is that you would need to have a template project for each of the different ecosystems that you then set the configuration, and add your resources to the www folder (or equivalent). This could be tedious, and a little time consuming. To make this process a little easier for developers, in comes PhoneGap Build, designed to take care of this step for you. You give them your universal PhoneGap app, based on your HTML, CSS and JavaScript (and possibly a little money, depending on your price plan), and they return you the signed apps, ready to be submitted. Awesome!
So in reality, there is nothing in PhoneGap Build that you couldn't do yourself (given enough time and effort), but they just make it easier for you to focus on the important thing, solving your original problems, and not spending time dealing with builds.
So to answer your final question, you have two choices: Use PhoneGap build to have it generate (pretty much) everything you need for both Android and iOS (As well as others), or set up new Template Projects for each, and drop in your resources in the associated www folder, and build it yourself. Check out the PhoneGap Download and the projects for the different platforms.
If you have any questions, comment on this answer, and I'll try to update as needed.
Update 1
Yes, PhoneGap Build provides app-store ready builds (See second advantage).
Get app-store ready apps without the headache of maintaining native SDKs. We do the work for you in the cloud and your app will always be built with the most up-to-date SDK for the platform you are targeting.