Tip: Instead of the CLI, use NativeScript Sidekick for easy app store publishing to both the iOS App Store and Google Play. Sidekick also offers starter kits, plugin management, and cloud-based builds for iOS and Android.
You can publish a NativeScript app in Google Play the same way you would release a purely native Android app.
- Make sure that you have a
.keystorefile to sign your app with. For more information, see How to create a .keystore file?
Build your project in release mode by running the following command:
tns build android --release --key-store-path <path-to-your-keystore> --key-store-password <your-key-store-password> --key-store-alias <your-alias-name> --key-store-alias-password <your-alias-password>
Note: At the end of
<path-to-your-keystore>you should also add the exact name of your keystore.
tns build android --release --key-store-path C:\keystore\Telerik.keystore --key-store-password sample_password --key-store-alias Telerik --key-store-alias-password sample_password.
tns build android --release --key-store-path ~/Desktop/keystore/Telerik.keystore --key-store-password sample_password --key-store-alias Telerik --key-store-alias-password sample_password.
- Obtain the release
- Publish your Android app by uploading the
.apkfile to the Google Developer Console. For more information, see How to publish an Android app?
Both Package Name, and Application Id, are unique identifiers, provided by you for your app.
Package Name is used to identify resources such as the
- Application Id is used to identify your app on devices and at the Google Play.
In the NativeScript framework, both are set to the
The NativeScript CLI build system will set them as the
package attribute in the generated project in
app/App_Resources/Android/AndroidManifest.xml it will use a placeholder:
package="__PACKAGE__". Do not modify the
package attribute there.
NOTE: To edit the Package Name and the Application Id, modify the
package.jsonof your app and set the
nativescript.idkey. You may need to delete
platforms/androidand rebuild using the CLI command
tns prepare android.
This is the display name for your app. It is purely cosmetic but highly important. For example, it appears under the app icon.
The value can be stored in the
<resources> <string name="app_name">MyAppName</string> <string name="title_activity_kimera">MyAppName</string> </resources>
By default (or if the project lacks the values above) your application name is generated with the
create command (e.g.
tns create testApp will have app name testApp)
You can check out more information about the elements you can define in the
App icons are defined similar to the app name.
The icon name is defined in the
app/App_Resources/Android/AndroidManifest.xml file, as an
android:icon="@drawable/icon" attribute, on the
The actual .PNG icons stay at the Android resources in
||120||Low density screen||36px x 36px|
||160||Medium density screen||48px x 48px|
||240||High density screen||72px x 72px|
||320||Extra-high density screen||96px x 96px|
||480||Extra-extra-high density screen||144px x 144px|
||640||Extra-extra-extra-high density screen||192px x 192px|
Note: NativeScript supports adaptive icons on Android 8 and above (API 26+). No code changes are required - follow the Android guidelines for creating adaptive icons for your application.
Android has no built-in mechanism to provide launch screen image. Here is a documentation article that describes how to implement a launch screen in the NativeScript framework.
These are automatically generated by the Android SDK tools for you.
In debug mode, you sign your app with a debug certificate. This certificate has a private key with a known password. The process is handled by the Android tooling.
You can read more at "Signing in Debug Mode".
The release certificate for Android is created by you; it does not have to be signed by a certificate authority. It is easier to create a release certificate for Android than it is for iOS. You should, however, be more careful with your certificate.
A few pitfalls are:
- You create the certificate only once. If you lose it, you will not be able to publish any updates to your app, because you must always sign all versions of your app with the same key.
- If your certificate expires, you will not be able to renew it. Ensure long validity when creating a new certificate (for 20+ years).
- If a third party obtains your private key, that party could sign and distribute apps that maliciously replace your authentic apps or corrupt them.
You can generate a private key for a release certificate using the keytool.
keytool -genkey -v -keystore <my-release-key>.keystore -alias <alias_name> -keyalg RSA -keysize 2048 -validity 10000
This will run an interactive session collecting information about your name, organization and most importantly — keystore and alias passwords.
You will need a developer account and you will need to log into the Google Play Developer Console.
Go to the All applications section and click the + Add new application button.
You will get prompted to provide the app title
You can then proceed with the store listings.
You can fill in app description, screenshots and so on.
You can also submit an APK. Read about how to obtain an APK from a NativeScript app.
We have already explained how the Application Id is set in your project, how icons are added to your app and how you can set the display name.
Before the build, you need to set two important things: the versionCode and the android:versionName.
When a build is uploaded, its versionCode should be larger than previous builds. A new build with a higher versionCode is considered an upgrade to builds that have a lower versionCode. The versionCode is an integer so you should carefully consider a strategy for versioning.
Both values are stored in
android:versionNameis a string value, which is used to represent the application version to the user whereas
android:versionCode, which is integer value showing version of the application code relative to the other versions. You can read more about "Versioning Your Applications".
app/App_Resources/Android/AndroidManifest.xml, the versionCode and versionName appear as:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.nativescript.name" android:versionCode="2" android:versionName="1.1"> ...
You can perform a full build and produce a signed APK using the NativeScript CLI:
tns build android --release --key-store-path <path-to-your-keystore> --key-store-password <your-key-store-password> --key-store-alias <your-alias-name> --key-store-alias-password <your-alias-password> --copy-to <apk-location>.apk
You can then use the produced
<apk-location>.apk for upload to Google Play.
If you want to reduce the apk sizes you can check how to achieve this in Android ABI Split article.
Submit with the Google Play Developer Console
To submit your app to the Google Play Developer Console:
- Log into the Google Play Developer Console.
- Select your application and go to the APK section.
- Choose Production, Beta or Alpha stage and click the Upload new APK.
- Select the APK produced by the CLI.
You can read more about these stages at "Set up alpha/beta tests".
Once you upload your APK, it will go through a review. When approved, you can move it to production to make it available on Google Play.
Once you successfully upload your APK, and it passes Google review, you will be able to move your APK to production, and it will go live on Google Play.