"Translate" Java, Kotlin, RN, flutter developed by the size of the App, you know it?

Source: Internet
Author: User

Now the way to develop the App is very many, native, reactnative, flutter is a good choice. Do you have any concerns about the size of the APK that is compiled and built using different methods? This article is a simple Hello world App, to see the different frameworks, the size of the compiled APK, what is the difference. Of course, the context of this article is a simple Apk, in fact, only partially explain the problem, do you think?

-Incense Ink Film

Mobile development So far, there are many ways to develop apps, such as native development based on a specific platform (using Java or Kotlin to develop Android, using OBJECTIVE-C or Swift to develop IOS); Based on the Re provided by Facebook Actnative, Walmart-based electrode Native, based on the Ionic framework, the use of Unity to develop specific apps, and the recently released Flutter.io framework to develop apps.

Have you ever wondered if these libraries and frameworks will have an impact on your App size?

Let's analyze the APK files for the applications written in these ways, which are very simple and contain only the top caption and the text control in the center of the screen (Hello world). This is a minimal basic App.

First of all, for this test, I will create four different versions of the APK. These are: Java, Kotlin, React Native, and flutter. The Android Api level is 27.

Then use Android Studio to compile the Release package, using the corresponding CLI to compile React Native and flutter.

They will use the default Proguard configuration, and finally we'll use the Android Studio's Analyze apk to analyze the APK.

Java (539 KB)

First, using Java to start this experiment, using Java to develop Android is the most common and simplest way. As described earlier, since we only use the Java and Android framework to create this application, it will be the smallest and only dependency is the Android support library, where you can see that it occupies quite a lot of space within the entire APK.

We can further reduce the size of the application by removing some dependent libraries and using Activity instead of appcompatactivity.

Kotlin (550KB)

Next, we use Kotlin. If you've written code for a long time in Java, I think Kotlin should make your eyes shine. The release version of the Kotlin application contains everything we can see in the Java APK, as well as some Kotlin-based syntax sugar information.

React Native (7MB)

If you have a front-end (WEB) development experience and want to use JavaScript to develop apps, then React Native is a good choice.

If you want to do faster feature iterations on your published apps, using React Native also lets you not have to publish the app market for every minor change.

The Release apk generated by React Native has several classes in the Classes.dex file that have 12,193 reference methods for this application.

It also adds some so libraries to the Lib directory of x86 and armeabi-v7a . A total of approximately 6.4 MB of space has been added.

Flutter (7.5MB)

In the release version of the application generated by the CLI of the flutter , the C + + engine and Dart VMs are included, which make up almost all the parts of the APK. The application runs directly with the native instruction set and does not involve any interpreter.

This article introduces several methods of writing the application, there are advantages and disadvantages, in the actual work, should be based on the need to choose the right way. You can also mix and match these frameworks, just to use their advantages to develop part of the APP's functionality.

For example, if you want to share code between IOS and Android apps, you can try to create some components using React Native, see the official documentation for React Native or Flutter.io If you're only interested in Android, and A PK size is a more important indicator for you, you can use Java or Kotlin.

The data in this article is actually based on one of the simplest apk, if it is to analyze the size of the APK, in fact, there is a very important indicator is not reference, that is, the increase in the amount of code, the impact of the APK size .

Reactnative and flutter because they also need to include some parser and engine, there will be some basic libraries inside, so it is expected to grow larger.

For example: Different city taxi start price is not the same, some cities may be 14 yuan start, some are 7 yuan starting price, but may be 14 yuan starting price of the late increase in the price per kilometer is lower than the starting price of 7 yuan. So in two cities, after how many kilometers to open, there will always be an average, so that their costs are equal.

The same is true in these frameworks, which are just different from the starting price .

Original link:
https://android.jlelse.eu/comparing-apk-sizes-a0eb37bb36f

Today in the public number back to the growth of " growth ", will be my collation of some of the study materials, but also can reply to " Dabigatran ", learning progress together.

Recommended reading:

    • Comic: Programmer, Can you "manage" your product manager?
    • Optimize Intent data transfer with Kotlin's features!
    • Solve the problem of Lottie animation including pictures!
    • Google's flutter learning materials!
    • Remote Control Smart TV, solution is open source!

"Translate" Java, Kotlin, RN, flutter developed by the size of the App, you know it?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.