APK size after upgrading to nativescript 4



My apk file size went up from roughly 35MB to 54MB after upgrading nativescript to 4. previously I was using the command “npm run start-android-bundle – --release --uglify --snapshot” to create apk and now its “tns build android --release --env.uglify --env.snapshot”

One thing I’ve noticed there was no tns_modules folder in the older apk, which exists in new build.

Just wondering if I’m using right commands to build release and why the apk size has gone up?


This happens sometimes, tns_module / node_modules get copied by mistake. Just try deleting the unwanted folders and a clean build.


Thank you,

could you please explain where should I delete the tns_modules?, by the way this happened after a clean build where I’ve removed platforms, hooks and node_modules folder and ran the build.


I may have found the issues, I’ve passed the --bundle flag to the release build and apk size back to 35MB. As per documentation if we don’t pass --bundle by default it uses the webpack. but looks like its not using webpack if we don’t use the flag --bundle.

Someone please validate.

Thank you.


I’m facing another error after passing the --bundle flag. I’ve a sqlite database file in app folder, which is not getting bundled into to apk when I pass that flag, any help?

Thank you.


@vamsi You’ll need to tell Webpack to bundle that file as-is. Similarly to what I’ve done here to ship audio files in a Webpacked app.


Thank you, that worked :+1: