Reputation: 19661
Both gradlew packageDebug
and gradlew assembleDebug
will create my APK. assembleDebug
appears to rely on packageDebug
, so what else is it doing for me? Is there some reason I should be using one or the other?
Upvotes: 7
Views: 10694
Reputation: 10182
If you run the gradle tasks:
gradle packageDebug --info
gradle assembleDebug --info
the secuence of gradle tasks executed are the same, except one, the last:
zipalignDebug
And referencing to zipalign, this task perform optimizations on apk file. This process is carried out once generated and signed the apk. That's why when you run on the two tasks, you see a generated apk file.
Upvotes: 5
Reputation: 9103
Use assembleDebug
, it's NOT equivalent to packageDebug
. assembleDebug
contains packageDebug
and perform other tasks as well.
Below you will find a list of all tasks included in assembleDebug
, one of them is packageDebug
.
app:assembleDebug - Assembles all Debug builds
app:checkDebugManifest
app:compileDebugAidl
app:compileDebugJava
app:compileDebugNdk
app:compileDebugRenderscript
app:dexDebug
app:generateDebugAssets
app:generateDebugBuildConfig
app:generateDebugResValues
app:generateDebugResources
app:generateDebugSources
app:mergeDebugAssets
app:mergeDebugResources
app:packageDebug
app:preBuild
app:preDebugBuild
app:preDexDebug
app:preReleaseBuild
app:prepareComAndroidSupportSupportV132000Library - Prepare com.android.support:support-v13:20.0.0
app:prepareComAndroidSupportSupportV42000Library - Prepare com.android.support:support-v4:20.0.0
app:prepareDebugDependencies
app:processDebugJavaRes
app:processDebugManifest
app:processDebugResources
app:validateDebugSigning
app:zipalignDebug
Additionally, from the Gradle Plugin documentation:
An Android project has at least two outputs: a debug APK and a release APK. Each of these has its own anchor task to facilitate building them separately:
- assemble
- assembleDebug
- assembleRelease
They both depend on other tasks that execute the multiple steps needed to build an APK. The assemble task depends on both, so calling it will build both APKs
Upvotes: 1