Nativescript 7.0 blank Hello World app size 30MB

189 views Asked by At

I created a new NS project with ns create and selected the plain JS template, after that I simply ran ns run android and the size of the APK I got is almost 30MB (29.7MB)

This is what Android Studio profiling shows (82.8% size is taken by lib):

enter image description here

An excerpt from this article on NativeScript's website says,

...blank NativeScript projects for Android are ~12MB by default because they include three copies of the NativeScript runtime built for different Android CPU architectures.

But that's clearly not the case here. I tried creating a new project with hello world vue template, the apk size was again around 30MB. Isn't that TOO MUCH? How can I get it to atleast 12MBs (as mentioned on the official website) ?

I tried ABI split mechanism as well, but even for a SEPARATE x86 build, size comes around 12.2MB. How to reduce the APK SIZE for a blank project?

1

There are 1 answers

1
Cem Kaan On

This can be an Old documentation issue again.

ns build android --env.uglify 

Will make some size fixes. But using --aab flag will make real difference

Check out this answer.


For nativescript-vue:

You can check package.json file of vue-cli-template you will see some packages are not used but still there.

You don't need :

  • @vue/devtools
  • nativescript-socketio
  • nativescript-vue-devtools
  • nativescript-toasty

https://github.com/nativescript-vue/vue-cli-template