How do I get APK from Android Studio?

An APK (Android Package Kit) is the file format for applications used on Android devices. After creating the required application one must compile it in APK format to upload it on Google Play. There are two methods through which APK files for an application are generated.

First are the debug APK files that are generated only for testing purposes. They will run on your Android device. However, they cannot be uploaded to Google Play Store or made available to the public. But these APK files can also be personally distributed to other Android users for installation on their devices. Android users can grant permission to their devices to install unknown apps if they want to access APK files from another source and install them directly.

Second, are the signed APK files that come in handy when the application has already been tested and is ready to be uploaded on the Google Play Store and released to the public. Signed APK is secured by a KeyStore credential made by the developer and includes a password for security purposes.

Generating a Debug APK file

Step 1: After building a project/application that you want to import into an APK file go to Build > Build Bundle(s)/APK(s) > Build APK(s) from the toolbar menu.

How do I get APK from Android Studio?

Output:

Android Studio will take a few minutes to generate the APK file. Once the APK file build is complete, you’ll receive a notification on the bottom right corner of your screen. Select Locate and you will find the APK file location. If you miss the notification, you can still find the APK file within the project folder: app/build/outputs/apk/debug. The file by default is named app-debug.apk.

How do I get APK from Android Studio?

Generating  a Signed APK File

Step 1: Sign in to your Google Account as shown below. If you are already logged in move to the next step.

How do I get APK from Android Studio?

Step 2:  From the toolbar, click on the ‘Build’ option and select the ‘Generate Signed Bundle / APK …’ as shown in the image below.

How do I get APK from Android Studio?

Step 3: Now on the appeared pop-up window select ‘APK’ in the radio button as shown in the image below. Then, click on the ‘Next’ button.

How do I get APK from Android Studio?

Step 4: Now Create a new KeyStore credential for your App by clicking on “Create New”.

How do I get APK from Android Studio?

Step 5: In ‘New Key Store’, browse a ‘Key store path’ by clicking on the Folder icon as shown. Then, provide a ‘Password’ and ‘Confirm’ password. Now, on the ‘Key’ section, provide an ‘Alias:’ or go with the already provided one. After that enter a ‘Password’ and ‘Confirm’ password. After that, you can move on to the ‘Certificate’ section. here, provide your ‘First and Last Name’. Enter your address details. After you have provided the required details, click on the ‘OK’.

How do I get APK from Android Studio?

Step 6: You will see the path for your KeyStore with the password you gave. Click on next.

Step 7: On the pop-up window select Release and end the process by clicking on Finish as shown below.

How do I get APK from Android Studio?

Output:

Android Studio will take a few minutes to generate the APK file. Once the APK file build is complete, you’ll receive a notification on the bottom right corner of your screen. Select Locate and you will find the APK file location. The Signed APK file is by default named app-release.apk. You will find it in the project folder in the app/release directory.  

How do I get APK from Android Studio?

Stay organized with collections Save and categorize content based on your preferences.

Android Studio 3.0 and higher allow you to profile and debug APKs without having to build them from an Android Studio project. However, you need to make sure you’re using an APK with debugging enabled.

To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen. Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK.

Android Studio then displays the unpacked APK files, similar to figure 1. This is not a fully decompiled set of files, though it does provide .smali files for a more readable version of the .dex files.

How do I get APK from Android Studio?

Figure 1. Importing a pre-built APK into Android Studio.

The Android view in the Project pane allows you to inspect the following contents of your APK:

  • APK file: Double-clicking the APK opens the APK analyzer.
  • manifests: Contains the app manifests that are extracted from the APK.
  • java: Contains Kotlin/Java code that Android Studio disassembles (into .smali files) from your APK’s DEX files. Each .smali file in this directory corresponds to a Kotlin/Java class.
  • cpp: If your app includes native code, this directory contains your APK’s native libraries (.so files).
  • External Libraries: Contains the Android SDK.

You can immediately use the Android profiler to start testing your app's performance.

To debug your app’s Kotlin/Java code, you need to attach the Kotlin/Java sources and add breakpoints in the .kt/.java files. Similarly, to debug your native code, you must attach native debug symbols.

Attach Kotlin/Java sources

By default, Android Studio extracts Kotlin/Java code from your APK and saves it as .smali files. To debug the Kotlin/Java code using breakpoints, you need to point the IDE to the .kt or .java source files that correspond to the .smali files you want to debug.

To attach Kotlin/Java sources, proceed as follows:

  1. Double click on a .smali file from the Project pane (use the Android view). After opening the file, the editor displays a banner asking you to select the Kotlin/Java sources:

How do I get APK from Android Studio?

  1. Click Attach Kotlin/Java Sources from the banner at the top of the editor window.
  2. Navigate to the directory with the app’s Kotlin/Java source files and click Open.

In the Project window, the IDE replaces .smali files with their corresponding .kt or .java files. The IDE also includes inner classes automatically. You can now add breakpoints and debug your app as you normally would.

Attach native debug symbols

If your APK includes native libraries (.so files) that don't include debug symbols, the IDE shows you a banner, similar to the one shown in figure 1. You cannot debug the APK’s native code or use breakpoints without attaching debuggable native libraries.

If you build the native libraries in your APK with a build ID, Android Studio checks whether the build ID in your symbol files matches the build ID in your native libraries and rejects the symbol files if there is a mismatch. If you did not build with a build ID, then providing incorrect symbol files may cause problems with debugging.

To attach debuggable native libraries, proceed as follows:

  1. If you haven't already done so, make sure to download the NDK and tools.
  2. Under the cpp directory in the Project window (visible only if you've selected the Android view, as shown in figure 2), double-click a native library file that doesn't include debug symbols. The editor shows a table of all the ABIs your APK supports.
  3. Click Add at the top right corner of the editor window.
  4. Navigate to the directory that includes the debuggable native libraries you want to attach and click OK.

If the APK and debuggable native libraries were built using a different workstation, you need to also specify paths to local debug symbols by following these steps:

  1. Add local paths to missing debug symbols by editing the field under the Local Paths column in the Path Mappings section of the editor window, as shown in figure 2. In most cases, you need only provide the path to a root folder, and Android Studio automatically inspects subdirectories to map additional sources. The IDE also automatically maps paths to a remote NDK to your local NDK download.
  2. Click Apply Changes in the Path Mappings section of the editor window.

How do I get APK from Android Studio?

Figure 2. Providing paths to local debug symbols.

You should now see the native source files in the Project window. Open those native files to add breakpoints and debug your app as you normally would. You can also remove the mappings by clicking Clear in the Path Mappings section of the editor window.

Known issue: When attaching debug symbols to an APK, both the APK and debuggable .so files must be built using the same workstation or build server.

In Android Studio 3.6 and higher, you no longer need to create a new project when the APK is updated outside the IDE. Android Studio detects changes in the APK and gives you the option to re-import it.

How do I get APK from Android Studio?

Figure 3. APKs updated outside Android Studio can be re-imported.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2020-08-25 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]

How do I get an APK file on my Android?

How to Extract APK on Your Android Using File Explorer.
Launch the File Explorer app on your Android..
On the app's main page, tap on “Apps.”.
Next, select the APK file you wish to extract. ... .
Select “Backup” located in the bottom navbar..
Head to “Open” to view the extracted apps..

How can I create APK file in Android Studio?

In the menu bar, click Build > Generate Signed Bundle/APK. In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next. Below the field for Key store path, click Create new.

Where can I find my APK file?

If you want to locate the APK files in your Android phones, you can find the APK for user-installed apps under /data/app/directory while the preinstalled ones are located in /system/app folder and you can access them by using ES File Explorer.

What is Android Studio APK?

An APK (Android Package Kit) is the file format for applications used on the Android operating system. APK files are compiled with Android Studio, which is the official integrated development environment (IDE) for building Android software. An APK file includes all of the software program's code and assets.