Table of Contents
How to Quickly Publish and Deploy NativeScript Apps
Nativescript is a framework for creating mobile apps using the familiar languages of Javascript, Typescript, or Angular.
It helps speed up development by requiring only one language to create both Android and iOS apps.
While frameworks like Nativescript can speed up development time, you will still need to understand each platform before you publish your application.
Publishing an Android App
To publish an Android app, you need to set the version number and then build and sign the app.
To set the version number in androidmanifest.xml, the “android:versionCode: should be an incremental integer value.
This is used to determine which build is more recent in the Google Play store.
The android:versionName will contain the version number that you want to display.
To sign the app, you need to create a .keystore file.
This can be done with the “keytool” app, which is included with the Java distribution.
In this case, we will have one keystore file store and one key for the app we want to publish.
keytool -genkey -v -keystore my-release-key.jks
-keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
**keysize = 2048 bit RSA key site
**validity = Number of days the app will be valid with this .keystore
After running the previous command, you will have the opportunity to assign the password for the keystore file, the key, and additional information like name, organization information, etc.
Once the keystore is generated, you can run the following command.
tns build android --release --key-store-path [Filepath to keystore] --key-store-password [Password for keystore file] --key-store-alias [Alias to key] --key-store-alias-password [Password to key alias]
The apk file will be generated to “/platforms/android/build/outputs/apk/” path.
The final steps are to take the output apk file and publish to the Google Play store.
Publishing an iOS App
In iOS, you can update the app version in the info.plist file.
“CFBundleShortVersionString” holds the version number you want to as public release, while the “CFBundleVersion” holds the internal build version for each production build.
The steps for publishing to the Apple AppStore go as follows.
Once your code is ready in the Xcode application, you submit it to the iTunes Connection.
Then, using the iTunes Connect website, you wait until the build has been processed.
Then, you will add a new version of the app, select the uploaded build, and submit your application for review.
You will need an Apple iTunes account to connect.
This account should have both a developer and distribution provisioning profile setup.
This will give the user permission to build and submit the app to the iTunes Connect store for deployment.
From NativeScript, you can run a command line command to automatically build and upload to iTunes connect.
But we prefer the more manual process, using Xcode.
tns build ios --release
Open the Xcode project file.
Verify that version and build numbers are set correctly and that the device type is accurate.
From the menu, select Product > Archive.
Then click “Upload to App Store.”
This will start the process of uploading to iTunes Connect.
Conclusion
Publishing and deploying NativeScript apps requires attention to platform-specific details for Android and iOS.
For Android, set the version number in androidmanifest.xml
, create a .keystore
file for app signing, and use the NativeScript build command to generate an APK file.
Once built, the APK file can be uploaded to the Google Play store.
In iOS, set the version and build numbers in info.plist
, and use Xcode to archive and submit the app to iTunes Connect.
While NativeScript offers commands to streamline this, we recommend using Xcode for better control over the submission process.
These steps ensure a smooth deployment for your NativeScript applications across platforms.