Migwell
Migwell

Reputation: 20107

Where is android studio building my .apk file?

I've been rebuilding my project from the ground up, so there's been a lot of problems with it. At the moment, everything's working great, except that when I try to run the app, I get the message 'Local path doesn't exist.', where the local path is pointing at the path: AndroidStudioProjects\MyProject\MyProject..\build\production\MyProject.apk, and true enough, there is no .apk file at that location, or indeed anywhere else in the project filesystem.

However, I can build the app with no problems, and running gradlew packageDebug gives me the message 'build successful', so .apks should be being generated. My question is, where are they going, or if they aren't being generated, why not?

Where is the build path of each module set? I'm somewhat confused because the Project Structure->Facets->Android->Compiler settings, Project Structure->Modules->Paths->Compiler Output, build.gradle, and MyProject.iml all seem to have something to do with the build path, but I don't quite understand how they relate

edit: I know where it should be, but it's not there so I want to know how to change the build path

edit 2: For some reason running gradlew build does create .apks, but not building or running from inside the program

edit 3: Here's my gradlew build output, note that it does build successfully:

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "target" on "com.android.build.gradle.LibraryExtension_Decorated@9e9aabc", value: "android-16".
:TwoWayLib:mergeReleaseProguardFiles UP-TO-DATE
:TwoWayLib:packageReleaseAidl UP-TO-DATE
:TwoWayLib:prepareReleaseDependencies
:TwoWayLib:compileReleaseAidl UP-TO-DATE
:TwoWayLib:generateReleaseBuildConfig UP-TO-DATE
:TwoWayLib:mergeReleaseAssets UP-TO-DATE
:TwoWayLib:compileReleaseRenderscript UP-TO-DATE
:TwoWayLib:mergeReleaseResources UP-TO-DATE
:TwoWayLib:processReleaseManifest UP-TO-DATE
:TwoWayLib:processReleaseResources UP-TO-DATE
:TwoWayLib:compileRelease UP-TO-DATE
:TwoWayLib:processReleaseJavaRes UP-TO-DATE
:TwoWayLib:packageReleaseJar UP-TO-DATE
:TwoWayLib:packageReleaseLocalJar UP-TO-DATE
:TwoWayLib:packageReleaseRenderscript UP-TO-DATE
:TwoWayLib:bundleRelease UP-TO-DATE
:Rogue:prepareRogueProjectTwoWayLibUnspecifiedLibrary UP-TO-DATE
:Rogue:prepareDebugDependencies
:Rogue:compileDebugAidl UP-TO-DATE
:Rogue:generateDebugBuildConfig UP-TO-DATE
:Rogue:mergeDebugAssets UP-TO-DATE
:Rogue:compileDebugRenderscript UP-TO-DATE
:Rogue:mergeDebugResources UP-TO-DATE
:Rogue:processDebugManifest UP-TO-DATE
:Rogue:processDebugResources UP-TO-DATE
:Rogue:compileDebug UP-TO-DATE
:Rogue:dexDebug UP-TO-DATE
:Rogue:processDebugJavaRes UP-TO-DATE
:Rogue:validateDebugSigning
:Rogue:packageDebug
:Rogue:assembleDebug
:Rogue:prepareReleaseDependencies
:Rogue:compileReleaseAidl UP-TO-DATE
:Rogue:generateReleaseBuildConfig UP-TO-DATE
:Rogue:mergeReleaseAssets UP-TO-DATE
:Rogue:compileReleaseRenderscript UP-TO-DATE
:Rogue:mergeReleaseResources UP-TO-DATE
:Rogue:processReleaseManifest UP-TO-DATE
:Rogue:processReleaseResources UP-TO-DATE
:Rogue:compileRelease UP-TO-DATE
:Rogue:dexRelease UP-TO-DATE
:Rogue:processReleaseJavaRes UP-TO-DATE
:Rogue:packageRelease
:Rogue:assembleRelease
:Rogue:assemble
:Rogue:check UP-TO-DATE
:Rogue:build
:TwoWayLib:mergeDebugProguardFiles UP-TO-DATE
:TwoWayLib:packageDebugAidl UP-TO-DATE
:TwoWayLib:prepareDebugDependencies
:TwoWayLib:compileDebugAidl UP-TO-DATE
:TwoWayLib:generateDebugBuildConfig UP-TO-DATE
:TwoWayLib:mergeDebugAssets UP-TO-DATE
:TwoWayLib:compileDebugRenderscript UP-TO-DATE
:TwoWayLib:mergeDebugResources UP-TO-DATE
:TwoWayLib:processDebugManifest UP-TO-DATE
:TwoWayLib:processDebugResources UP-TO-DATE
:TwoWayLib:compileDebug UP-TO-DATE
:TwoWayLib:processDebugJavaRes UP-TO-DATE
:TwoWayLib:packageDebugJar UP-TO-DATE
:TwoWayLib:packageDebugLocalJar UP-TO-DATE
:TwoWayLib:packageDebugRenderscript UP-TO-DATE
:TwoWayLib:bundleDebug UP-TO-DATE
:TwoWayLib:assembleDebug UP-TO-DATE
:TwoWayLib:assembleRelease UP-TO-DATE
:TwoWayLib:assemble UP-TO-DATE
:TwoWayLib:check UP-TO-DATE
:TwoWayLib:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 10.848 secs

Upvotes: 165

Views: 404334

Answers (19)

touhid udoy
touhid udoy

Reputation: 4444

If you just built an apk/bundle and missed to click locate button on the popup, you will find that popup inside Notifications tab inside Android Studio.

notifications

Upvotes: 0

With "Android Studio 2023.2.1", now in 2024-04, it is like this:

5.1 ( Burger Menu ) > Build > Rebuild Project

”( Burger Menu ) > Build > Select Build Variant…”.
    “Build Variants:”.
        “Module” = ”:app”
        “Active Build Variant”.
            “debug ( default )”.
            “release”.
”( Burger Menu ) > Build > Rebuild Project”.
    “AndroidStudioProjects\{project name}\app\build\outputs\apk\debug\app-debug.apk”.
    “AndroidStudioProjects\{project name}\app\build\outputs\apk\release\app-release-unsigned.apk”.
You may either create a “debug” or a “release” item.
One directory with the item is created. Other items in the directory are deleted.
If the other directory exist, it is deleted.
    When building a “release” build, the “debug” directory is deleted.
    When building a “debug” build, the “release” directory is deleted.
So you can't generate “bundle” files by this.
So you may have just either a “debug” or a “release” item at the same time :-).

5.2 ( Burger Menu ) > Build > Build Bundle(s) / APK(s)

”( Burger Menu ) > Build > Select Build Variant…”.
    “Build Variants:”.
        “Module” = ”:app”
        “Active Build Variant”.
            “debug ( default )”.
            “release”.
”( Burger Menu ) > Build > Build Bundle(s) / APK(s)”.
    “Build APK(s)”:
        “AndroidStudioProjects\{project name}\app\build\outputs\apk\debug\app-debug.apk”.
        “AndroidStudioProjects\{project name}\app\build\outputs\apk\release\app-release-unsigned.apk”.
    “Build Bundle(s)”.
        “AndroidStudioProjects\{project name}\app\build\outputs\bundle\debug\app-debug.aab”.
        “AndroidStudioProjects\{project name}\app\build\outputs\bundle\release\app-release.aab”.
    You may either create a “debug” or a “release” item.
    One directory with the item is created. Other items in the directory are deleted.
    If the other directory exist, it is not deleted.
    So you may have “apk” and “bundle” directories and so “apk” and “bundle” files at the same time :-).

5.3 ( Burger Menu ) > Build > Generate Signed Bundle / APK...

”( Burger Menu ) > Build > Generate Signed Bundle / APK…”.
    “Build APK(s)”.
        “AndroidStudioProjects\{project name}\app\debug\app-debug.apk”.
        “AndroidStudioProjects\{project name}\app\release\app-release.apk”.
    “Build Bundle(s)”
        “AndroidStudioProjects\{project name}\app\debug\app-debug.aab”.
        “AndroidStudioProjects\{project name}\app\release\app-release.aab”.
    You may either create “debug” or “release” items, or “debug” and “release” items at the same time.
    One directory with the item is created. Other items in the directory are deleted.
    If one item is generated, and if the other directories exist, they are not deleted.
    So you may have “debug” and “release” directories directories at the same time :-). But you can have either “apk” and “bundle” files at the same time :-(.

Upvotes: 1

M Waqar Anwar
M Waqar Anwar

Reputation: 36

As of Nov 2023, for react native, it is located in: /android/app/build/outputs/apk/development/debug/here-is-the-apk

Upvotes: 1

Jignesh Patel
Jignesh Patel

Reputation: 449

For latest Android Studio Chipmunk|2021.2.1 Patch 2 the path to the Apk file is

MySampleAndroidApp\app\build\intermediates\apk\debug\app-debug.apk

Upvotes: 25

Jonas Simonaitis
Jonas Simonaitis

Reputation: 320

Android Studio BumbleBee 2021.1.1 Patch 3

Android Studio Bumblebee | 2021.1.1 Patch 3 Build #AI-211.7628.21.2111.8309675, built on March 16, 2022 Runtime version: 11.0.11+0-b60-7590822 x86_64

yourProject/build/intermediates/apk/debug/debug.apk

Upvotes: 5

Dmitriy Mitiai
Dmitriy Mitiai

Reputation: 1200

Here is a small gradle script, which should help to find the output apk file. Probably it will work with aab:

applicationVariants.all { variant ->
    variant.getAssembleProvider().get().doLast { assemble ->
        def outputFile = variant.outputs*.outputFile
        println "\n\n\nOUTPUT FILE -> $outputFile\n\n\n"
    }
}

Put it insid the android body. Have a good coding

Upvotes: 1

Yvgen
Yvgen

Reputation: 2212

You can find it in the

project -> app (or your main app module) -> build -> outputs -> apk

Upvotes: 8

Sajid khan
Sajid khan

Reputation: 615

You should Build your app instead of debugging process. Just follow this:

Build -> Build Bundles/APK(s) -> Build APK(s)

enter image description here

Upvotes: 32

giveJob
giveJob

Reputation: 1540

in android 3.1.0 Above use below path to find signed version of APK

home/AndroidStudioProjects/<projedct name>/app/app-release.apk

and in windows

AndroidStudioProjects\{project name}\app\release\app-release.apk

Upvotes: 10

fvolodimir
fvolodimir

Reputation: 445

In my case to get my debug build - I have to turn off Instant Run option :

File → Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run.

Then after run project - I found my build into Application\app\build\outputs\appDebug\apk directory

Upvotes: 1

Arsman Ahmad
Arsman Ahmad

Reputation: 2211

After compiling my code in Android Studio, I found it here:

~\MyApp_Name\app\build\outputs\apk\app-debug.apk

Upvotes: 24

HeavenHM
HeavenHM

Reputation: 992

Mine application's apk was at this location

C:\Users\haseeb_mir\AndroidStudioProjects\MyTestApp\app\build\outputs\apk\debug

Upvotes: 7

Jonathan
Jonathan

Reputation: 135

For Android Studio:

If you haven't built the APK at least once, you might not find the /Outputs/APK folder. Go to Build in Android Studio and one of the last three options is Build APK, select that. It will then create that folder and you will find your APK file there.

Upvotes: 9

Manan Gupta
Manan Gupta

Reputation: 481

Go to AndroidStudio projects File

  1. Select the project name,
  2. Select app
  3. Select build
  4. Select Outputs
  5. Select Apk

You will find APK files of app here, if you have ran the app in AVD or even hardware device

Upvotes: 23

Mehdi Boukhechba
Mehdi Boukhechba

Reputation: 2581

YourApplication\app\build\outputs\apk

Upvotes: 213

roshan213
roshan213

Reputation: 243

I was having the issue finding my debug apk. Android Studio 0.8.6 did not show the apk or even the output folder at project/project/build/. When I checked the same path project/project/build/ from windows folder explorer, I found the "output" folder there and the debug apk inside it.

Upvotes: 10

astryk
astryk

Reputation: 1255

When you have android studio make your signed apk file it uses

    <property name="ExportedApkPath" value="$PROJECT_DIR$/PROJNAME/APPNAME.apk" />

inside workspace.xml to find out where to place it. However, if you use ./gradlew assembleRelease it places it inside PROJNAME/build/apk. I have the same problem. For some reason my android studio will not show me anything inside the apk subdirectory so the apk is for all intents and purposes missing. But if you search with finder it's most definitely there.

Upvotes: 1

alikonda
alikonda

Reputation: 1216

Take a look at this question.

TL;DR: clean, then build.

./gradlew clean packageDebug 

Upvotes: 2

Alex Fu
Alex Fu

Reputation: 5529

When Gradle builds your project, it puts all APKs in build/apk directory. You could also just do a simple recursive find command for *.apk in the top level directory of your project.

Here is a better description...

https://i.sstatic.net/XwjEZ.png

View full image at https://i.sstatic.net/XwjEZ.png

Upvotes: 6

Related Questions