Question:
How to make an apk file from a project in Android Studio for downloading to other devices?
Answer:
There are at least two ways:
1. Manually
From the Android Studio menu, choose Build
– Generate Signed APK
.
Next, create a keystore and the key itself, which will sign the application.
In the next step, choose Build type
– release
, Finish
. Next, by clicking Show in Explorer
, the directory with the APK will open.
2. Using gradlew assembleRelease
In build.gradle
set up the release configuration:
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file("my-release-key.jks")
storePassword "password"
keyAlias "my-alias"
keyPassword "password"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
...
}
}
}
Next, from the root directory of the project, run gradlew assembleRelease
.
Unless memory changes, by default the APK will be in %APP_DIR%\app\build\outputs\apk
.
More detailed information can be found in the official documentation .