In Preparing an App for Releasethe Archive Manager was used to build the app and place it in an archive forsigning and publishing. This section explains how to create an Androidsigning identity, create a new signing certificate for Androidapplications, and publish the archived app ad hoc to disk. Theresulting APK can be sideloaded into Android devices without goingthrough an app store.
-->
Oct 19, 2018 App Signing is a new process available for developers that allows us to offload the signing of our release APKs onto Google. Once we have provided the Play Console with our app signing key. Sign your app. Generate an upload key and keystore. Sign your app with your upload key. Opt in to app signing by Google Play. Upload your app to Google Play. Prepare & roll out release of your app.
In Archive for Publishing,the Distribution Channel dialog presented two choices fordistribution. Select Ad-Hoc:
In Archive for Publishing,the Sign and Distribute.. Microsoft windows xp product key generator. dialog presented us with two choices fordistribution. Select Ad-Hoc and click Next:
Create a New Certificate
After Ad-Hoc is selected, Visual Studio opens the SigningIdentity page of the dialog as shown in the next screenshot. Topublish the .APK, it must first be signed with a signing key (alsoreferred to as a certificate).
An existing certificate can be used by clicking the Import button and then proceeding toSign the APK. Otherwise, click the click the+ button to create a new certificate:
The Create Android Key Store dialog is displayed; use this dialogto create a new signing certificate that can use for signingAndroid applications. Enter the required information (outlined in red)as shown in this dialog:
The following example illustrates the kind of information that must be provided. Click Create to create the new certificate:
The resulting keystore resides in the following location:
C:UsersUSERNAMEAppDataLocalXamarinMono for AndroidKeystoreALIASALIAS.keystore
![]()
For example, using chimp as the alias, the above steps would create a new signingkey in the following location:
C:UsersUSERNAMEAppDataLocalXamarinMono for AndroidKeystorechimpchimp.keystore
Note
Be sure to back up the resulting keystore file and password in asafe place – it is not included in the Solution. If you lose yourkeystore file (for example, because you moved to another computer orreinstalled Windows), you will be unable tosign your app with the same certificate as previous versions.
For more information about the keystore, seeFinding your Keystore's MD5 or SHA1 Signature.
After clicking Ad-Hoc, Visual Studio for Mac opens the Android SigningIdentity dialog as shown in the next screenshot. To publish the .APK,it must first be signed it with a signing key (also referred to as acertificate). If a certificate already exists, click the Import anExisting Key button to import it and then proceed toSign the APK Otherwise, click the Create a NewKey button to create a new certificate:
The Create New Certificate dialog is used to create a new signingcertificate that can be used for signing Android applications. ClickOK after entering in the necessary information:
The resulting keystore resides in the following location:
~/Library/Developer/Xamarin/Keystore/alias/alias.keystore
For example, the above steps might create a new signingkey in the following location:
~/Library/Developer/Xamarin/Keystore/chimp/chimp.keystore
Note
Be sure to back up the resulting keystore file and password in asafe place – it is not included in the Solution. If you lose yourkeystore file (for example, because you moved to another computer orreinstalled macOS), you will be unable tosign your app with the same certificate as previous versions.
For more information about the keystore, seeFinding your Keystore's MD5 or SHA1 Signature.
Sign the APK
When Create is clicked, a new key store (containing a newcertificate) will be saved and listed under Signing Identity as shownin the next screenshot. To publish an app on Google Play, clickCancel and go toPublishing to Google Play.To publish ad-hoc, select the signing identity to use for signing andclick Save As to publish the app for independent distribution. Forexample, the chimp signing identity (created earlier) is selectedin this screenshot:
Next, the Archive Manager displays the publishing progress. Whenthe publishing process completes, the Save As dialog opens to askfor a location where the generated .APK file is to bestored:
Navigate to the desired location and click Save. If the keypassword is unknown, the Signing Password dialog will appear toprompt for the password for the selected certificate:
After the signing process completes, click Open Distribution:
This causes Windows Explorer to open the folder containing thegenerated APK file. At this point, Visual Studio has compiled theXamarin.Android application into an APK that is ready for distribution.The following screenshot displays an example of the ready-to-publishapp, MyApp.MyApp.apk:
As seen here, a new certificate was added to the key store. To publishan app on Google Play, click Cancel and go toPublishing to Google Play.Otherwise click Next to publish the app ad-hoc (for independentdistribution) as shown in this example:
The Publish as Ad Hoc dialog provides a summary of the signed appbefore it is published. If this information is correct, clickPublish.
The Output APK file dialog will save the APK to the path specified. Click Save.
Next, enter the password for the certificate (the password that wasused in the Create New Certificate dialog) and click OK:
The APK is signed with the certificate and saved to the specifiedlocation. Click Reveal in Finder:
This opens the finder to the location of the signed APK file:
The APK is ready to copy from the finder and send to its finaldestination. It's a good idea to install the APK on an Android deviceand try it out before distribution. SeePublishing Independentlyfor more information about publishing an ad-hoc APK.
Next Steps
After the application package has been signed for release, it must bepublished. The following sections describe several ways to publishan application.
Android requires that all apps be digitally signed with a certificate before they can be installed. In order to distribute your Android application via Google Play store it needs to be signed with a release key that then needs to be used for all future updates. Since 2017 it is possible for Google Play to manage signing releases automatically thanks to App Signing by Google Play functionality. However, before your application binary is uploaded to Google Play it needs to be signed with an upload key. The Signing Your Applications page on Android Developers documentation describes the topic in detail. This guide covers the process in brief, as well as lists the steps required to package the JavaScript bundle.
Generating an upload key
You can generate a private signing key using
keytool . On Windows keytool must be run from C:Program FilesJavajdkx.x.x_xbin .
This command prompts you for passwords for the keystore and key and for the Distinguished Name fields for your key. It then generates the keystore as a file called
my-upload-key.keystore .
The keystore contains a single key, valid for 10000 days. The alias is a name that you will use later when signing your app, so remember to take note of the alias.
On Mac, if you're not sure where your JDK bin folder is, then perform the following command to find it:
It will output the directory of the JDK, which will look something like this:
Navigate to that directory by using the command
$ cd /your/jdk/path and use the keytool command with sudo permission as shown below.
Android App Signing Generate An Upload Key In Windows 10
Note: Remember to keep the keystore file private. In case you've lost upload key or it's been compromised you should follow these instructions.
Setting up Gradle variables
These are going to be global Gradle variables, which we can later use in our Gradle config to sign our app.
Note about security: If you are not keen on storing your passwords in plaintext, and you are running OSX, you can also store your credentials in the Keychain Access app. Then you can skip the two last rows in
~/.gradle/gradle.properties .
Adding signing config to your app's Gradle config
The last configuration step that needs to be done is to setup release builds to be signed using upload key. Edit the file
android/app/build.gradle in your project folder, and add the signing config,
Generating the release APK
Run the following in a terminal:
Gradle's
bundleRelease will bundle all the JavaScript needed to run your app into the AAB (Android App Bundle). If you need to change the way the JavaScript bundle and/or drawable resources are bundled (e.g. if you changed the default file/folder names or the general structure of the project), have a look at android/app/build.gradle to see how you can update it to reflect these changes.
Note: Make sure gradle.properties does not include org.gradle.configureondemand=true as that will make the release build skip bundling JS and assets into the app binary.
The generated AAB can be found under
android/app/build/outputs/bundle/release/app.aab , and is ready to be uploaded to Google Play.
Note: In order for Google Play to accept AAB format the App Signing by Google Play needs to be configured for your application on the Google Play Console. If you are updating an existing app that doesn't use App Signing by Google Play, please check our migration section to learn how to perform that configuration change.
Testing the release build of your app
Before uploading the release build to the Play Store, make sure you test it thoroughly. First uninstall any previous version of the app you already have installed. Install it on the device using:
Note that
--variant=release is only available if you've set up signing as described above.
You can kill any running packager instances, since all your framework and JavaScript code is bundled in the APK's assets.
Android App Signing Generate An Upload Key FreePublishing to other stores
By default, the generated APK has the native code for both x86 and ARMv7a CPU architectures. This makes it easier to share APKs that run on almost all Android devices. However, this has the downside that there will be some unused native code on any device, leading to unnecessarily bigger APKs.
You can create an APK for each CPU by changing the following line in android/app/build.gradle:
Upload both these files to markets which support device targeting, such as Google Play and Amazon AppStore, and the users will automatically get the appropriate APK. If you want to upload to other markets, such as APKFiles, which do not support multiple APKs for a single app, change the following line as well to create the default universal APK with binaries for both CPUs.
Upload App To App StoreEnabling Proguard to reduce the size of the APK (optional)
Proguard is a tool that can slightly reduce the size of the APK. It does this by stripping parts of the React Native Java bytecode (and its dependencies) that your app is not using.
![]()
IMPORTANT: Make sure to thoroughly test your app if you've enabled Proguard. Proguard often requires configuration specific to each native library you're using. See
app/proguard-rules.pro .
To enable Proguard, edit
android/app/build.gradle :
Migrating old Android React Native apps to use App Signing by Google PlayAndroid App Signing Generate An Upload Key Free
If you are migrating from previous version of React Native chances are your app does not use App Signing by Google Play feature. We recommend you enable that in order to take advantage from things like automatic app splitting. In order to migrate from the old way of signing you need to start by generating new upload key and then replacing release signing config in
android/app/build.gradle to use the upload key instead of the release one (see section about adding signing config to gradle). Once that's done you should follow the instructions from Google Play Help website in order to send your original release key to Google Play.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |