APK size after upgrading to nativescript 4


#1

Hello

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?


#2

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


#3

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.


#4

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.


#5

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.


#6

@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.


#7

Thank you, that worked :+1: