How to make an APK from Android Studio? Create signed package

The ultimate goal of any java development is to create a complete application: it can be either a library/executable jar file or a web application. There are different types of applications and libraries. With all the variety of possible different types of ready-made libraries and applications, Android devices are out of the ordinary. For Android devices, the final software product is apk files that can be freely distributed between users.

At the dawn of software development, all development for Android devices was carried out, as a rule, in the Eclipse IDE with specialized plugins such as ADT (Android Development Tools). This development environment allows you to create apk files

. But times are changing quickly, and today it is much more efficient and faster to create apk files in Android Studio, introduced back in 2013, based on an old competitor of Eclipse - the IntelliJ IDEA system.

Abbreviation apk

(Android Package Kit) symbolizes the file format that is used to distribute and install applications on Android devices. The apk file contains all the necessary elements for the correct installation of the application on the device, and, in its purpose, is somewhat similar to executable exe files in Windows. When you “go to the Google Play store” to select and download an application, your Android device downloads and installs the apk file with the desired application.

How to make an APK from Android Studio?

Creating an APK or signed package from Android Studio is a necessary step to set up an app on the Google Play Store, as Google Android App Bundle and Google Play APK Bundle are the packages that need to be created in order to upload an app bundle to the Play Store‌ and have the app published on GooglePlayStore.

Below is a continuation of our example of creating the best budget Android app using free existing code from the TravelPayouts affiliate program.

TravelPayouts Affiliate Program and Flight Booking App Development Code WhereCanIFLY Where Can I FLY - Best Budget App for Android

APK File Structure

In conclusion, let's look at the insides of our apk file. I should immediately note that the apk file can be opened with a zip archiver, for example 7-Zip. But much will remain inaccessible. It is better to use the apk file analyzer from Android Studio. You don’t have to go far: you need to select the menu item “Build → Analyze APK …” (see the top screenshot). In the dialog box that opens, find the required package in the file structure, after which a panel will open in the IDE, as shown in the following screenshot.

The analyzer panel interface is divided into 2 parts. At the top you can see the root structure of the apk file. In the lower part, you can view the structure of the selected element in the upper part.

What immediately catches your eye?

Let's remember: in our example/module we used an external library with the Felix OSGi framework
org.apache.felix.framework-6.0.3.jar
, located in the lib subdirectory. In the structure of the created package, the lib subdirectory.
All files of the external jar library are located in the root according to packages. It can be assumed that the additional use of bundles/modules (and why use the framework if not to use bundles) will lead to the fact that their content will also be integrated into the overall package. Thus, we are deprived of the benefits of using OSGi technology when developing applications for Android devices, since any modification of a separate module/bundle will be associated with updating the entire assembly (apk package). In addition, there is no possibility of simultaneous use of different version bundles, and inter-module interaction through services becomes “too expensive” (you can directly access the bundle classes, why do we need an intermediary activator). In this simple example, I don't see the benefit of using OSGi to create a multi-module application. I would be grateful to anyone who will refute this assumption and suggest a meaningful use of OSGi technology in an Android device.
As for *.classes, they will not be in the apk file either. They were replaced by *.dex files.

Create a signed package or APK from Android Studio

Creating a signed package or APK from AndroidStudio‌ is quite easy as long as you can use a new download key and haven't forgotten your download key password - otherwise it won't work.

To create an APK from Android Studio, start by opening the Create Signed Package or APK menu.

Creating a signed package of an Android app in Android Studio: Build > create signed package/APK

Then choose whether you want to create a signed Google Android app package or a Google Play APK.

In order to generate a signed package, you will need to provide a key. If you have an existing key, use the Select Existing button.

If not, start creating a new key.

What is an APK file

Modern programs typically consist of dozens of documents and folders that require a lot of space. The Android Studio integrated development environment, running under Windows, OS X and Linux, provides a service for compiling programs for the Android platform. The result is a single packaged executable file in AndroidPackageKit (APK) format that provides installation of the application with the necessary libraries and resources. During the unpacking process, the user selects a complete installation or unpacking individual components. The second option is usually chosen by developers for further viewing and editing of the program.

Create a new Play Store download key

To create a new download key, enter all the required information in the form: keystore path, associated passwords, nickname, associated key password, expiration date in years, first and last name, organizational unit, organization, city or locality, state or province, and ISO country code.

Then generate a key that will be saved on your computer.

You can now create your Google Android app bundle, and you can upload the app bundle to the Play Store‌—unless you encounter an issue such as using a new key for an existing app.

Application decompilation

In this article, we only worked with disassembled application code, but if more serious changes are made to large applications, understanding the smali code will be much more difficult. Fortunately, we can decompile the dex code into Java code, which, although not original and not compiled back, is much easier to read and understand the logic of the application. To do this, we will need two tools:

  • dex2jar is a translator of Dalvik bytecode into JVM bytecode, on the basis of which we can obtain code in the Java language;
  • jd-gui is a decompiler that allows you to get readable Java code from JVM bytecode. As an alternative, you can use Jad (www.varaneckas.com/jad); Although it is quite old, in some cases it generates more readable code than Jd-gui.

This is how they should be used. First, we launch dex2jar, specifying the path to the apk package as an argument:

% dex2jar.sh mail.apk

As a result, the Java package mail.jar will appear in the current directory, which can already be opened in jd-gui to view the Java code.

Obtain PEM key certificate from boot key

After installing the Java program, you can finally install the KeyStore Explorer program.

Select Open an existing key vault to begin.

Then find the key in .jks format on your computer that you created earlier using AndroidStudio.

A password will be asked to open this key and you will have to provide it to enter its details.

Once the key has been opened, double-click on it to use it to download the app bundle to the Play Store by double-clicking on it.

All the details will be displayed and you can click on the PEM button to access the famous PEM certificate.

When the PEM certificate is displayed, simply click "Export" to save it to your computer and submit the file to Google Play support to reset the download key.

After a while they will confirm that the key has been reset and that you can use the new upload key to generate signed packages or APKs to upload an app bundle to the Play Store - it will still take a few days for the new keys to become valid.

The entire operation of resetting the download key on Google Play takes about a week, after which you can download the Google Android app bundle again in the new release of the application.

WhereCanIFLY Android Travel Apps

View and Modify

Let's say you found a package that interests you, downloaded it, unpacked it... and when you tried to view some XML file, you were surprised to discover that the file was not text. How to decompile it and how to work with packages in general? Is it really necessary to install the SDK? No, it is not necessary to install the SDK at all. In fact, all the steps to extract, modify and package APK packages require the following tools:

  • ZIP archiver for unpacking and packing;
  • smali - Dalvik virtual machine bytecode assembler/disassembler (code.google.com/p/smali);
  • aapt is a tool for packaging resources (by default, resources are stored in binary form to optimize application performance). Included in the Android SDK, but can be obtained separately;
  • signer - a tool for digitally signing a modified package (bit.ly/Rmrv4M).

You can use all these tools separately, but this is inconvenient, so it is better to use higher-level software built on their basis. If you work on Linux or Mac OS X, there is a tool called apktool. It allows you to unpack resources in their original form (including binary XML and arsc files), rebuild a package with changed resources, but it does not know how to sign packages, so you will have to run the signer utility manually. Despite the fact that the utility is written in Java, its installation is quite non-standard. First you need to get the jar file itself:

$ cd /tmp $ wget https://bit.ly/WC3OCz $ tar -xjf apktool1.5.1.tar.bz2

Next, we will need a binding script to launch apktool (by the way, it is also available for Windows), which also includes the aapt utility, which will be needed to package the package:

$ wget https://bit.ly/WRjEc7 $ tar -xjf apktool-install-linux-r05-ibot.tar.bz2

Next, we simply dump the contents of both archives into the ~/bin directory and add it to $PATH:

$ mv apktool.jar ~/bin $ mv apktool-install-linux-r05-ibot/* ~/bin $ export PATH=~/bin:$PATH

If you work on Windows, then there is an excellent tool for it called Virtuous Ten Studio, which also accumulates all these tools (including the apktool itself), but instead of a CLI interface it provides the user with an intuitive graphical interface with which you can perform operations for unpacking, disassembling and decompiling in a few clicks. This tool is Donation-ware, that is, sometimes windows appear asking you to get a license, but in the end this can be tolerated. There is no point in describing it, because you can understand the interface in a few minutes. But apktool, due to its console nature, should be discussed in more detail.


Import APK into Virtuous Ten Studio

Let's look at the apktool options. In short, there are three basic commands: d (decode), b (build) and if (install framework). If everything is clear with the first two commands, then what does the third, conditional statement, do? It unpacks the specified UI framework, which is necessary in cases where you dissect any system package.

Let's look at the most interesting options of the first command:

  • -s - do not disassemble dex files;
  • -r - do not unpack resources;
  • -b - do not insert debugging information into the results of disassembling the dex file;
  • --frame-path - use the specified UI framework instead of the one built into apktool. Now let's look at a couple of options for the b command:
  • -f - forced build without checking changes;
  • -a — specify the path to aapt (a tool for building an APK archive), if for some reason you want to use it from another source.

Using apktool is very simple; to do this, just specify one of the commands and the path to the APK, for example:

$ apktool d mail.apk

After this, all extracted and disassembled files of the package will appear in the mail directory.

Common application release update problems

My Android app update is not rolling out: If a new release is not offered for download to users who have already installed the app, and the app release on the Google Play console shows as published with all live updates, it may be because the version code and version name have not been updated, preventing phone users from identifying the update as a new version.
How do you release an Android app update? Make sure the version number has been updated in the AndroidManifest.xml file or in the build.gradle file. A new version of the application is installed in the Play Store, but the update is not showing

Extracting ARC from the program

Of course, extracting files from a regular ARC can be quite simple. This can even be done using a regular archiver. But what to do if the program is already installed, but the ARC from it has already been lost? A small program called APK Extractor . With its help you can extract an archive from almost any ARK program.

You can download APK Extractor, for example, from the Google Play store using the link: https://play.google.com/store/apps/details? >


Download APK Extractor from Google Play Store

However, the utility is quite good and can successfully cope with many programs on Android. An undoubted advantage is that APK Extractor does not require root access. And it’s very easy to use:

  • First you need to run APK Extractor on your mobile device;
  • Then a list of programs installed on your smartphone or tablet will appear in the program window;
  • You will need to mark the ARC from which you want to extract;
  • And wait until APK Extractor does its job;
  • APK Extractor folder in any file manager - this is where the elongated APK is located.


Extracting ARC from the program

In addition, the program supports the ability to send the unpacked file by email. You can also transfer the ARC to your computer. It is also possible to save the ARC in cloud storage. Of course, this will require you to link the APK Extractor program to your mail or storage.

You can work with ARC files extracted in this way in the future at your discretion. You can, for example, add your own files to the archive, or edit existing ones. Or you can simply be curious about what exactly is in this or that file, in order to further use third-party experience and developments in your activities. In short, there are plenty of applications for this. As you can see, there are still ways to remove ARC from an installed application.

pros

  • It is possible to create several workspaces, establish connections between them, allocate space for advertising units - in total there are about a hundred different settings. The functionality is by eye, approximately 80% of what AppsGeyser has, and 90% of App Inventor. And a bunch of other personal tricks. And the whole enterprise works quickly, beautifully and well.


Andromo: these tabs contain a lot of interesting things

  • Excellent comments on every feature. You get used to it instantly.
  • The finished assembly is compiled in the cloud using the official version of the Android SDK. This is a plus for speed, quality and reliability of work.

Conclusion

The service is very good. It is extremely difficult to find fault with ergonomics, user friendliness and speed of operation. For a person who is far from programming, this is the best option.

Remarkable projects of our compatriots

Appsgeyser.ru

Enterprising guys from Novosibirsk Academgorodok launched the Russian version of AppsGeyser. Since February 2012, almost 20 thousand applications have been created using it. The functionality is much inferior to its bourgeois counterpart. The preview (the main feature of appsgeyser.com) often behaves inappropriately. But this company has a wonderful Russian-language blog that is worth checking out.

Yandex.Store

Volozh's team strives to catch up and overtake Google in everything. In February 2013, we launched our app store. Notable for paying for purchases via SMS and checking installation files with Kaspersky antivirus. Contains more than 85 thousand applications. There is no moderation. In addition to the standard publication data entry form, it is possible to upload an AppDF file. The application appears in search 15 minutes after it is sent to the store. Judging by the number of downloads of top applications, the audience of store users is still extremely small.

AppDF format

The idea was implemented with the participation of Yandex developers. A file with the extension appDF (App Description File) is a compilation of an apk with information about the application (description, screenshots, developer contacts - just a few dozen parameters). Needed to save time when publishing to several markets. You can create an appDF on the project website. Unfortunately, only a few stores support it (CodeNgo, Opera Mobile Store, SlideME and Yandex.Store).

Andromo

Service from Indigo Rose Software. This company has been producing all sorts of goodies for developers since 1991. Among them are Setup Factory (for creating installers), TrueUpdate (for creating updaters) and a number of other popular products that you most likely have already used. The reputation of the “blue rose” is wow! And Andromo is another confirmation of what serious professionals work there.

Conclusion

The overall impression is positive. At first, I even wanted to award him first place in this review, but the agonizing wait for a letter and the attempt to squeeze out money to create a second application upset me.

appsbar

This service is mentioned in the article for the benefit of those comrades who, in childhood, were hit on the head with a keyboard by a computer science teacher (while they were solving a quadratic equation in Pascal), which discouraged them from even looking at the program code. But their hidden resentment still drives them towards a total takeover of the galaxy. With the help of appsbar, you can realize your wildest fantasies, resulting in a cross-platform (!) application.

ES File Explorer

ES File Explorer is a common and widely used Android file management app that is available for free on Android 4.0+. With this free file management app, you can extract system files from your mobile phone. In fact, the application does this automatically. You can simply share or move the APK file to any other device using email or instant messaging services. Once you open the app on your mobile phone, go to the Home section and tap the app button. You will see all the extracted APK files. The best part of this application is that you can find some system application files. However, there is a minus, this application shows advertisements. If you want to disable it, you will have to purchase the paid version.

An alternative to mobile applications is a chatbot

Instead of a mobile application, you can use a chatbot on a social network or instant messenger. This is a good option if you don’t yet have the resources or desire to deal with creating applications.

A chatbot for business can have many useful functions, from onboarding to payment. For users, this is already a familiar tool, and they don’t have to install anything on their phone: everything works in familiar messengers.

Here are three cases of chatbots that solve real business problems. All done in the SendPulse chatbot builder.

  • Bot for online conference participants. He gave out the program, helped contact the organizers, sent reminders and useful materials.
  • Bot for fans of a football club. Developed on a free plan, it replaced the entire application: here is the game schedule, purchasing tickets and merchandise, information about players and coaches, as well as a special section to buy food at the stadium during the match.
  • Bot for clients of the Tsapa cafe in Chernigov. Here, the standard cafe functionality is fully packaged into Facebook Messenger. You can view the menu, order delivery or a table, find out the address and leave a review.

We have compiled a whole section with examples of chatbots. There you can study the functionality and test each bot.

Bots made in SendPulse are easily scalable. You can launch a baby that has a FAQ and a link to the site, and then turn it into a full-fledged store with a system for attracting and retaining customers, linking it with CRM and email newsletters. Register and create up to three chatbots with a free plan.

When can you create an application yourself?

Do you remember what website visitors need? They come because of the content or functionality of the resource. People want to get information, buy something, look at and comment on friends' photos, and so on. Mobile app users need the same. They are looking for information or making some kind of transaction.

Do you remember when a business could make a website on its own? It’s right when you don’t yet have money to collaborate with professionals, but you still have the time and desire to figure out WordPress or Joomla. The same situation is with applications. Self-created programs for iOS and Android can be roughly compared to websites built on open source engines.

This is what we're talking about: you can open an online store, a cool portal or a corporate website on 1C-Bitrix or on a custom engine. The same problem can be solved using Drupal, Joomla! or OpenCart. It’s the same with applications: you can pay a lot of money to top developers, or you can satisfy the needs of your audience with the help of online designers.

Try making the application yourself if:

  • You are taking your first steps in business and adhering to the principles of bootstrapping. The audience will forgive minor shortcomings of a novice entrepreneur, but will kill a large enterprise because of them. Therefore, do not create an application yourself if you own a business on the scale of Euroset.
  • Your clients need a program for smartphones and tablets with very simple functionality. For example, you can do without developers if you want to convert a website into an application.
  • You and your audience are happy with the template design of the application. This point can be formulated as follows: if the content and functionality of the program are excellent, few people will pay attention to the design.
  • A successful or unsuccessful application launch will not have an immediate or significant impact on the business. For example, if you attract and serve most of your clients offline, but you are developing an application for the future, there is room for experimentation.
  • You needed an application yesterday. Here you will have to choose one of two options: pay developers for ready-made standard code or use a designer.
  • You don't want to depend on developers. If you are afraid that the studio will charge you too much for support and program updates, use ready-made solutions. Just remember that they also need to be kept up to date.

Have you decided to make the program yourself? Move on.

Opening using standard phone utilities

How to install an APK file on Android - instructions

You can open the APK using standard operating system tools. To do this, you must follow the following instructions:

  1. First you need to open “Settings”.
  2. In the system menu, go to the “Security and Privacy” section.
  3. Go to “Install from unknown sources” and activate this option.
  4. Next, you need to go to the folder where the desired element is located.
  5. Click on it to launch the stock Android installer.


Standard phone settings

Important! Using standard tools, you can only perform installation; you cannot view the structure or perform editing.

Super Backup & Restore

This is a universal application that can make backup copies of all the programs that you have installed on your phone. It doesn't matter what it is: applications, SMS, contacts, call logs or anything else. Super Backup & Restore is a universal solution for backing up and restoring data for Android. Many people who are not logged into a Google account on a new mobile phone use this application to move all the important data from the old phone to the new one. This application is available for free, and you can download it on Android starting from version 4. The user interface of Super Backup & Restore is quite good and runs smoothly without any lag.

How to download APK file from Google Play using Astro File Manager

To do this, you actually need to download this file manager from the Play Market. In addition to extracting the APK file, this program can manage backup of installed applications, viewing videos and images.

Launch the application and swipe left. The main menu of the application will open, where you will need to click on “Application Manager”. After this, you will see a window showing all the applications installed on your device. We look in the list for the application whose APK file we want to extract and click here.

In the window that opens, click on the “Backup” button and wait until the phone’s backup copy is saved in the phone’s memory. This is our APK file. By default, the program saves a backup copy in the device's native memory, in the storage/sdcard/bakups/apps folder.

Rating
( 1 rating, average 5 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]