generate apk in android studio code example

Example 1: how to generate android studio apk

/*How you can extract an APK file using Android Studio?
In the Android menu, go to Build > Build Bundle(s) / APK (s) > Build APK(s).
Android Studio will start building the APK for you. ...
The 'locate' button should open File Explorer with the debug folder open that contains a file called “app-debug. ...
That's it.*/

Example 2: how to generate signed apk of android project

android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file("my.keystore")
            storePassword "password"
            keyAlias "MyReleaseKey"
            keyPassword "password"
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}

Tags:

Misc Example