Distributing applications


 4.2 Distributing applications

Now you’re ready to send your app out into the world. Soon it will reside not only on your Android device, but also on the devices of people around the globe. It’s an exciting step! But how will you do this? Well, the most common way to share an Android app is through the Google Play Store, where more than 2.8 million Android apps are available.

  • Distributing through an app marketplace

Usually, to reach the broadest possible audience, you’d distribute your apps through a marketplace, such as Google Play.

  • Distributing your apps by email

A quick and easy way to release your apps is to send them to users by email. To do this, you prepare the app for release, attach it to an email, and send it to a user. 

  • Distributing through a website

If you don't want to release your apps on a marketplace such as Google Play, you can make them available for download on your website or server, including on a private or enterprise server. 

Working With the Package Name

  • First, set a new package name for the app. The package name needs to be unique and remain unchanged in Google Play. Commonly, developers use the reverse domain name format, like this:

    com.your_domain.app_name

  • The best way to refactor an app’s package name in Android Studio is to start in the Project pane. With the Android view chosen, select the settings icon:
  • You’ll see a drop-down menu with several project viewing options. Make sure Compact Middle Packages is unchecked.
  • Now you can refactor the parts of the package name separately. Right-click on the package named ampics, and select Refactor ▸ Rename. After you see a warning window, click Rename Package in the window.
  • Next, you’ll see a new window where you can change the old name to your name or domain name. Click Refactor to enable renaming the package.
  • After you apply changes, check the Android view to make sure you changed your folder’s name.

Packaging Your App for Distribution

  • Android requires that APKs are digitally signed with a certificate before they can be installed. The certificate identifies the developer of the app. You can find more information about app signing in the official documentation.
  • There are two ways of distributing apps – using the traditional Android Application Package (APK) format and the new Android App Bundle (AAB) format. In August 2021, Google decided all new apps ready for publishing to Google Play have to be in the form of the Android App Bundle to support Dynamic Delivery. However, when you need a full application package just to do a clean install to a new device, use the APK format.
  • In the following sections, you’ll learn about both of them. But, before you jump into it, you need to create a keystore for your app.

Creating a New Keystore

  • To create a signed app bundle or package, you’ll use KeyStore — the storage place for your saved certificates. Be sure to keep these private!
  • Luckily, you’ll need to use only one command line. Open Android Studio Terminal and add the following line to it:

keytool -genkey -v -keystore my-app-release-key.keystore -alias alias_name -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 10000

  • However, before you run it, you’ll need to modify it:
  • Instead of my-app-release-key, specify a name for your keystore. Usually, developers replace it with company’s name.
  • Replace alias_name with an alias for the new key, which is a name you’ll use later with the keystore path and password.
  • Replace “10000”, with the number of years that the key will be valid. Make this at least 25 so that you can sign app updates with the same key throughout the lifespan of your app.
  • Once you fill in the information, run the command. Next, enter a password for the keystore. It needs to be at least 6 characters long, and it needs to remain private.
  • Then, you’ll be asked to re-enter the password. And, the terminal will ask you to answer a few personal questions — like, “what is your name?”, “what is your organization called?”, etc. All information will be stored in your keystore.
  • After you answer the questions, the terminal will finish the process, and Android Studio will create your keystore inside the app folder. Don’t lose it, because you’ll need it and its password info to make any updates to your app! If you are using a version control system, you shouldn’t be including this file in it. Don’t allow unauthorized people to have access to it, either.
  • With your app keystore ready, you can finally learn how and where to use it.

Creating a Signed APK

  • If you want to distribute the app in one file, you can create a Signed APK. With this method, you’ll package all your app’s resources into one zip file.
  • In Android Studio, select Build ▸ Generate Signed Bundle / APK…. You’ll see a window for choosing an app format. Select APK.
  • Next, you have to sign the app. To do that, you need to use the keystore data created in the previous section. Select Choose existing… and navigate to its location. Then, fill out its password, alias name and enter a wanted password for the app key.
  • Check Remember passwords to make things easier in the future and click Next.
  • The next step asks you to choose a destination folder for your signed bundle. Select the proper folder, then select release for the Build Variants. Finally, click Finish.
  • When the packaging process is complete, Android Studio will notify you that your APK is ready and let you open it in the File Manager.
  • Now that you generated your APK successfully, you can install it on a device by double-clicking on it.

Creating a Signed Bundle

  • The App Bundle is a new delivery format for Android apps that helps to deliver an optimized version of your APK. It only includes what your users need. This reduces your app size, which is a plus for many users. It means that your users will receive a special version of your APK that only includes the language, screen density and resources they need per unique user configuration.

  • Now it’s time for you to create your own Android app bundle. Just like in the previous section, select Build ▸ Generate Signed Bundle / APK…. When you’re asked to choose between building an Android App Bundle or an APK, select Android App Bundle.
  • Notice that there’s a difference between the window you build an APK with and the window you build an AAP with, though. There’s an option to export an encrypted key. When building an APK, it’s not needed. As before, choose the keystore path, enter an alias name and passwords, and click Next. Then, choose Build Variant and click Finish. You’re already a pro at this! :]
  • When the packaging process is complete, Android Studio will notify you that your bundle is ready and let you browse it in the File Manager.

Using the Google Play Developer Console

  • Finally, you’re ready to start the process of sharing your app with other people. In the browser, sign in to your Google account.
  • Then, navigate to Google Play Developer Console.
  • Next, agree to the Google Play Developer distribution agreement, pay the one-time $25 fee and then complete your profile with the required personal information.
  • Now you’re ready to start publishing apps on Google Play. Click Create app.
  • Specify the default language for the app, the app name, the app category and whether the app is free or paid.
  • Then, check all the fields in the Declarations section. Finally, click Create app.
  • This creates a draft store listing for your app. Don’t be overwhelmed by all the information and options. There’s not that much left for you to do.
  • If you take a look at the Publish your app on Google Play section, you can see that this part is locked.
  • You have to complete the initial setup tasks first. So what are the initial setup tasks? Take a look at the Set up your app section.
  • Here is the list of tasks you need to do before you continue:
    • Set up app access and content rating.
    • Set up app target audience and news apps.
    • Set up COVID-19 contact tracing and status apps.
    • Select an app category and provide contact details.
    • Finally, you must set up your store listing.

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form