I want to build android app and start signing it. For that I need to have Release version of apk. Google documentation suggests only Eclipse and ant ways to have release builds: http://developer.android.com/tools/publishing/app-signing.html#releasecompile
However I cannot find how to force gradle build release version of apk. build.gradle
does not give any hints either. gradlew tasks
suggests, that there is no install Release configuration, but uninstall release exists:
Install tasks
-------------
installDebug - Installs the Debug build
installTest - Installs the Test build for the Debug build
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build
uninstallRelease - Uninstalls the Release build
uninstallTest - Uninstalls the Test build for the Debug build
My build.gradle
:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile files('libs/android-support-v4.jar')
compile project(":libraries:ActionBarSherlock")
compile project(":libraries:CollabsibleSearchMenu")
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
}
}
What I am missing?
in the latest version of android studio, you can just do:
or
aR
for short. This will produce an unsigned release apk. Building a signed apk can be done similarly or you can use Build -> Generate Signed Apk in Android Studio.See the docs here
Here is my build.gradle for reference:
No need to update gradle for making release application in Android studio.If you were eclipse user then it will be so easy for you. If you are new then follow the steps
1: Go to the "Build" at the toolbar section. 2: Choose "Generate Signed APK..." option.
3:fill opened form and go next 4 :if you already have .keystore or .jks then choose that file enter your password and alias name and respective password. 5: Or don't have .keystore or .jks file then click on Create new... button as shown on pic 1 then fill the form.
Above process was to make build manually. If You want android studio to automatically Signing Your App
In Android Studio, you can configure your project to sign your release APK automatically during the build process:
On the project browser, right click on your app and select Open Module Settings. On the Project Structure window, select your app's module under Modules. Click on the Signing tab. Select your keystore file, enter a name for this signing configuration (as you may create more than one), and enter the required information. Figure 4. Create a signing configuration in Android Studio.
Click on the Build Types tab. Select the release build. Under Signing Config, select the signing configuration you just created. Figure 5. Select a signing configuration in Android Studio.
4:Most Important thing that make debuggable=false at gradle.
visit for more in info developer.android.com
To activate the
installRelease
task, you simply need asigningConfig
. That is all.From http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Android-tasks:
Here is what you want:
Here is how to obtain the
installRelease
task:Example
build.gradle
:Build Variants
debug
torelease
shift+f10
run!!then, Android Studio will execute
assembleRelease
task and install xx-release.apk to your device.