Home Berries How to install apk file to computer. How to open apk file on computer

How to install apk file to computer. How to open apk file on computer

If you have an Android smartphone, tablet or other device based on this operating system, then you have probably come across the word "APK". But, not all users of the Android operating system know what an APK is.

APK or Android Package are files in which Android applications are distributed. An APK file is an archive that contains the executable code for the application, as well as other files and resources that the application needs to run. APK files are not encrypted and are part of the well-known ZIP format.

APK files have a well-defined structure.

    • MANIFEST.MF - a file with data about other files in this archive (file checksums);
    • CERT.RSA - the certificate that signed the application;
    • CERT.SF - file with data about the certificate and resources;
    • armeabi - for ARMv6 and older processors;
    • armeabi-v7a - for ARMv7 and newer processors;
    • x86 - for processors with x86 architecture;
    • mips - for MIPS processors;
  • res - resources not contained in resources.arsc (see below).
  • Assets - The assets used by the AssetManager.
  • AndroidManifest.xml - a file with a description of the application. This file stores the name, package name, version, and other data related to this application.
  • classes.dex - executable code in DEX format;
  • resources.arsc - compiled resources;

It is very easy to view the contents of the APK file and anyone can do it. All you need to do is open the APK file with any archiver. For example, you can use the free 7Zip archiver.

Where can I get the APK file?

You can download and install the APK file from the Google Play app store. You can also download the APK from other sites that distribute software. Often, the APK file can be downloaded from the application developer's website.

How to install APK files?

APK files downloaded from Google Play are installed automatically. If you need one that you downloaded from another site, then you need to enable the installation of programs from unknown sources and run the APK file on your Android device. After that, you will see a warning about installing the application. Click "OK" to start the installation process.

Mobile devices and gadgets have become part of our life. They mainly use Google's Android operating system or Apple's iOS. Considering the quite democratic cost of Android smartphones, it is clear that this system is the most widespread. And there are a lot of applications for it. All applications launched in the system from Google have the extension ".apk". If you need to figure out how to open the file. apk on a computer - check out the contents of this article.

How to open an apk file on a computer and what it is

Literally, this abbreviation stands for "Android Package". This file format was invented by the Open Handset Alliance and Google and is a special type of archive that contains all the information necessary for the application to work. The launch of such a file is only possible on the Android operating system.

Open the apk file

In fact, it is an archive. Therefore, by copying it to your computer, you can familiarize yourself with its contents using, for example, the 7z archiver or WinRAR. It will be seen that this archive contains the program code, add-ons, necessary multimedia resources and service information.

Launching a mobile application on Windows

If you need to find out the functionality of a file, and not open its contents, then you cannot do without additional programs for Windows. A good helper in this matter is Google's Android SDK - a special application that emulates the operation of a smartphone. With it you can run, debug or create a new application. Another option for opening a file with an apk extension is the Eclipce program with an ADT extension.

Sometimes some applications on Android do not suit the user in some way. An example is annoying ads. And it also happens - everyone is good at the program, but only the translation in it is either crooked, or is completely absent. Or, for example, the program is trial, but it is not possible to get the full version. How can the situation be changed?

Introduction

In this article, we'll talk about how to disassemble an APK package with an application, look at its internal structure, disassemble and decompile the bytecode, and also try to make several changes to the application that can bring us one or another benefit.

To do all this on your own, you will need at least a basic knowledge of the Java language, in which Android applications are written, and the XML language, which is used everywhere in Android - from describing the application itself and its access rights to storing the strings that will be displayed on the screen. You will also need the ability to handle specialized console software.

So, what exactly is the APK package in which absolutely all the software for Android is distributed?

Decompiling applications

In this article, we worked only with disassembled application code, however, if you make more serious changes to large applications, it will be much more difficult to understand the smali code. Fortunately, we can dex 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 need two tools:

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

They should be used like this. First, we run dex2jar, specifying the path to the apk package as an argument:

% dex2jar.sh mail.apk

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

APK package device and getting them

An Android app package is essentially a regular ZIP file that doesn't require any special tools to view or decompress its contents. It is enough to have an archiver - 7zip for Windows or console unzip for Linux. But that's about the wrapper. What's inside? Inside, we generally have the following structure:

  • META-INF /- contains a digital certificate of the application, certifying its creator, and checksums of the package files;
  • res / - various resources that the application uses in its work, for example, images, a declarative description of the interface, and other data;
  • AndroidManifest.xml- application description. This includes, for example, a list of required resolutions, required Android version and required screen resolution;
  • classes.dex- compiled application bytecode for the Dalvik virtual machine;
  • resources.arsc- also resources, but of a different kind - in particular, strings (yes, this file can be used for Russification!).

The listed files and directories are, if not in all, then perhaps in the vast majority of APKs. However, there are a few more not-so-common files / directories worth mentioning:

  • assets- analogue of resources. The main difference is that to access an asset, you need to know its identifier, while the list of assets can be obtained dynamically using the AssetManager.list () method in the application code;
  • lib- native Linux libraries written with the NDK (Native Development Kit).

This directory is used by game makers to host a game engine written in C / C ++, as well as high-performance application makers (such as Google Chrome). The device was sorted out. But how do you get the package file itself for the application of interest? Since it is not possible to pick up APK files from the device without root (they are in the / data / app directory), and root is not always advisable, there are at least three ways to get the application file to the computer:

  • APK Downloader extension for Chrome;
  • Real APK Leecher application;
  • various file sharing and warezniki.

Which one to use is a matter of taste; we prefer to use separate applications, so we will describe the use of Real APK Leecher, especially since it is written in Java and, accordingly, will work even in Windows, even in nix.

After starting the program, you need to fill in three fields: Email, Password and Device ID - and select a language. The first two are the e-mail and password of your Google account, which you use on the device. The third is the device identifier, and you can get it by dialing the code on the dialer # #8255## and then finding the line Device ID. When filling out, you need to enter only the ID without the android- prefix.

After filling and saving, the message "Error while connecting to server" often pops up. It has nothing to do with Google Play, so feel free to ignore it and look for the packages you are interested in.

View and Modify

Suppose you have found a package you are interested in, downloaded, unpacked ... and while trying to view some XML file, I was surprised to find that the file is not text. How to decompile it and how to work with packages in general? Is it really necessary to install the SDK? No, you don't have to install the SDK. In fact, all the steps for unpacking, modifying, and packaging APK packages require the following tools:

  • ZIP archiver for unpacking and packing;
  • smali- assembler / disassembler bytecode of the Dalvik virtual machine (code.google.com/p/smali);
  • aapt- a tool for packing resources (by default, resources are stored in binary form to optimize application performance). Included with the Android SDK, but can also 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 the 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 cannot 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 rather non-standard. First you should get the jar file itself:

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

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

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

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

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

Let's consider the most interesting options of the first command:

  • -s- do not disassemble dex files;
  • -r- do not unpack resources;
  • -b- do not insert debug 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 assembly without checking changes;
  • -a- we indicate 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, for this you just need to specify one of the commands and the path to the APK, for example:

$ apktool d mail.apk

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

Dissection. Disable ads

Theory is, of course, good, but why is it needed if we do not know what to do with the unpacked package? Let's try to apply the theory to our advantage, namely, modify some software so that it does not show us ads. For example, let it be Virtual Torch - a virtual torch. For us, this software is perfect because it is packed to capacity with annoying ads and, moreover, simple enough not to get lost in the jungle of code.


So, using one of the above methods, download the application from the market. If you decide to use Virtuous Ten Studio, just open the APK file in the application and unpack it, for which create a project (File -> New project), then select Import File from the context menu of the project. If your choice fell on apktool, then it is enough to execute one command:

$ apktool d com.kauf.particle.virtualtorch.apk

After that, a file tree similar to the one described in the previous section will appear in the com.kauf.particle.virtualtorch directory, but with an additional smali directory instead of dex files and an apktool.yml file. The first contains the disassembled code of the executable dex file of the application, the second contains the service information needed by apktool to build the package back.

The first place we should look is, of course, AndroidManifest.xml. And here we immediately meet the following line:

As you might guess, she is responsible for granting the application permission to use the Internet connection. In fact, if we just want to get rid of ads, we will most likely need to disable the Internet for the application. Let's try to do this. We delete the specified line and try to build the software using apktool:

$ apktool b com.kauf.particle.virtualtorch

The resulting APK file will appear in the com.kauf.particle.virtualtorch / build / directory. However, you will not be able to install it, since it does not have a digital signature and file checksums (it simply does not have the META-INF / directory). We need to sign the package using the apk-signer utility. Launched. The interface consists of two tabs - on the first (Key Generator) we create keys, on the second (APK Signer) we sign. To create our private key, fill in the following fields:

  • Target File- the output file of the keystore; it usually contains one key pair;
  • Password and Confirm- password for the storage;
  • Alias- the name of the key in the repository;
  • Alias ​​password and Confirm- secret key password;
  • Validity- validity period (in years). The default is optimal.

The rest of the fields are generally optional - but at least one must be filled in.


WARNING

To sign an application using apk-signer, you must install the Android SDK and specify the full path to it in the application settings.

All information is provided for informational purposes only. Neither the editorial board nor the author is responsible for any possible harm caused by the materials of this article.

Now you can sign the APK with this key. On the APK Signer tab, select the newly generated file, enter the password, key alias and password to it, then find the APK file and boldly press the "Sign" button. If all goes well, the package will be signed.

INFO

Since we signed the package with our own key, it will conflict with the original application, which means that when we try to update the software through the market, we will receive an error.

A digital signature is required only for third-party software, so if you are modifying system applications that are installed by copying them to the / system / app / directory, then you do not need to sign them.

After that, we drop the package onto a smartphone, install and launch it. Voila, ads are gone! Instead, however, a message appeared that we do not have the Internet or do not have the appropriate permissions. In theory, this could be enough, but the message looks annoying, and, to be honest, we were just lucky with a dumb app. A normally written software will most likely clarify its powers or check for an Internet connection and otherwise simply refuse to start. How to be in this case? Of course, edit the code.

Typically, application authors create special classes for displaying advertisements and call methods of these classes during application launch or one of its "activities" (to put it simply, application screens). Let's try to find these classes. We go to the smali directory, then com (org contains only the open graphics library cocos2d), then kauf (exactly there, because this is the name of the developer and all his code is there) - and here it is, the marketing directory. Inside we find a bunch of files with the smali extension. These are classes, and the most notable of them is the Ad.smali class, by the name of which it is easy to guess what exactly it displays ads.

We could change the logic of its operation, but it would be much easier to remove calls to any of its methods from the application itself. Therefore, we leave the marketing directory and go to the adjacent particle directory, and then to virtualtorch. The MainActivity.smali file deserves special attention here. This is a standard Android class that is created by the Android SDK and set as the entry point to the application (analogous to the main function in C). Open the file for editing.

Inside is the smali code (local assembler). It is quite confusing and difficult to read due to its low-level nature, so we will not study it, but simply find all references to the Ad class in the code and comment them out. We drive in the line "Ad" in the search and find ourselves on line 25:

Field private ad: Lcom / kauf / marketing / Ad;

This is where an ad field is created to hold an object of class Ad. Commenting by placing the ### sign in front of the line. We continue to search. Line 423:

New-instance v3, Lcom / kauf / marketing / Ad;

This is where the object is created. We comment. We continue the search and find in lines 433, 435, 466, 468, 738, 740, 800 and 802 calls to the methods of the Ad class. We comment. Look like that's it. We save. Now you need to put the package back together and check its performance and the presence of ads. For the purity of the experiment, we return the string deleted from AndroidManifest.xml, collect the package, sign and install.

Our guinea pig. Advertising visible

Oops! Advertising disappeared only while the application was running, but remained in the main menu, which we see when we launch the software. So, wait, but the entry point is the MainActivity class, and the ads disappeared while the application was running, but remained in the main menu, so the entry point is different? To identify the true entry point, reopen the AndroidManifest.xml file. And yes, it has the following lines:

They tell us (and more importantly, the android) that an activity named Start should be launched in response to the generation of an intent (event) android.intent.action.MAIN from the android.intent.category.LAUNCHER category. This event is generated when tapping on the application icon in the launcher, so it defines the entry point, namely the Start class. Most likely, the programmer first wrote an application without the main menu, the entry point to which was the standard MainActivity class, and then added a new window (activity) containing the menu and described in the Start class, and manually made it the entry point.

Open the Start.smali file and again look for the line "Ad", find in lines 153 and 155 the mention of the FirstAd class. It is also in the source code and, judging by the name, is precisely responsible for displaying ads on the main screen. We look further, there is a creation of an instance of the FirstAd class and an intent, according to the context related to this instance, and then the cond_10 label, the conditional transition to which is carried out exactly before creating an instance of the class:

If-ne p1, v0,: cond_10 .line 74 new-instance v0, Landroid / content / Intent; ...: cond_10

Most likely, the program somehow randomly calculates whether to show ads on the main screen, and, if not, jumps straight to cond_10. Ok, let's simplify her task and replace the conditional jump with an unconditional one:

# if-ne p1, v0,: cond_10 goto: cond_10

There are no more references to FirstAd in the code, so close the file and reassemble our virtual torch using apktool. Copy it to your smartphone, install it, launch it. Voila, all ads have disappeared, and congratulations to all of us.

Outcomes

This article is just a brief introduction to the techniques for cracking and modifying Android applications. Many issues remained behind the scenes, such as removing protection, parsing obfuscated code, translating and replacing application resources, as well as modifying applications written using the Android NDK. However, having basic knowledge, it is only a matter of time to figure it out.

When we find a file with an unknown extension among Windows files, we often feel discouraged. The devil only knows what this is unrecognized by the "axis". Such thoughts occur to many people who first saw the "apk" extension. Having an apk file, how can I open this thing on Windows?

Before answering this question, it is necessary to understand what kind of beast is in front of us. The ".apk" file format was developed by Google for the purpose of storing Android OS executable applications in this format. The very concept of storing programs and data in one archive is not new. Even at the dawn of the spread of personal computers, the packaging of programs in an archive was very popular. To run such applications, it was not even necessary to unpack this archive - the system tools did it independently. This technology is also in circulation in the circles of developers and users of various kinds of emulators. Therefore, Google's idea is not something out of the ordinary or unexpected.

Apk stands for “Android Package”. This is an ordinary archive, which can be opened by almost any archiver available for Windows.

The archive contains the following application components:

  • The source code of the program.
  • Application resources like pictures, sounds, etc.
  • A special file called manifest.

Those wishing to open such a file with an archiver will need to follow our further instructions.

We make an autopsy

Since apk is an archive, we will try to open it with an archiver program. For Windows, many multifunctional archiving programs have been developed that can create and open an archive of almost any format. Apk files are no exception. Let's point out two such archivers for Windows that successfully cope with this task: WinRar and 7-zip. If the first of these programs is commercial, then the second is completely free, and you can download it directly from the website of its developer - Igor Pavlov - at: http://www.7-zip.org/ or http: // 7-zip .org.ua / ru /.

Install the 7-zip archiver in Windows (unless, of course, this famous program has already found a haven on your computer).

Right-click on the required apk file. The context menu should appear, as usual.

We select the menu item "7-zip" - a submenu will appear with a choice of options.

We ask the archiver to open the archive or extract data from the archive. This can be done in different ways by selecting a particular submenu item, for example, the "Open archive" item (only to view the contents) or the "Unpack" item. The user will be prompted to specify the folder to unpack and other optional parameters.

That's all you need to know to open an apk file.

Most applications can always be downloaded from the official Google Play store, however, not all existing programs are presented there, and some applications simply have a high price. They can also be downloaded for free on the Internet. When you find what you want, you will notice that it is a so-called apk file. A logical question appears, how to open and install it. This can be done using standard settings and third-party software.

A bit of theory and the essence of the problem

Before talking about the methods, let's find out what this very apk file is. This is the format of the installation package for the operating system on Android. Extension is an abbreviation for the English Android Package. In fact, this file is the most common archive, which contains a variety of pictures, program code and other components that are essential for the correct operation of the program. If you want to see what is inside, just use the most common file manager, for example, Total Comander.

However, many baud users use the word “open” to mean “install” an application. Here everything is already a little more complicated, since you should use the installer so that all the contents are unpacked correctly. When downloading from the Play Store, this is done automatically. But if you manually downloaded the apk file, then you need to open it in a different way.

Use of regular funds

Android OS (as opposed to iOS) is an open OS. This means that every user can supply third-party software without any restrictions. For this, the system provides standard tools that allow you to install apk files.

Let's find out how to install apk file on Android. There are a few simple steps to follow:

  1. Go to the "Settings" section of your gadget.
  2. Find the item "Security".
  3. In the menu, find the item "Unknown sources", and then put a tick in front of it. This will allow third party applications to be installed.
  4. Drop the apk file onto your phone (you can stick out the memory card, write to it and insert it back).
  5. Go to the standard explorer, while finding the installation package.
  6. Click on it and confirm the installation.

After these steps, the smartphone will install the program for several tens of seconds. In the list of applications, you can find the one you are looking for, and then launch it.

If the procedure seems extremely difficult to you, but you have any difficulties, try using a file manager. The Play Market has a huge selection of such managers. We recommend using ASTRO File Manager or one of the most popular - ES File Explorer.

They have a nice interface, and also allow you to quickly and easily open the necessary apk-file. The instruction practically does not differ from the one described above:

  1. Download the installation file to your SD card.
  2. Start the file manager, and then find the file on the map.
  3. Click on it to start the installation.

Application managers are an alternative option. They are more "sharpened" for working with programs, so they are ideal for opening apk. You can use the SlideME Mobentoo App Installer. It is worth choosing it for one simple reason - it automatically scans your memory card, and then finds available installers. You don't have to search for them for a long time. It is enough to select the desired apk and click on it.

New on the site

>

Most popular