Simplify NativeScript Publishing Process

Simplify NativeScript Publishing Process

native publishingHow to quickly publish and deploy your 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 an understanding of each platform before you publish your application.

To publish Android app, you need to set the version number, 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 following command, you will have 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.

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” hold 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.