Amey Jahagirdar
Amey Jahagirdar

Reputation: 485

What is the difference between gradlew build and gradlew assembleRelease

I want to build apk from command line with the help of gradle. Which command should I use to build apks for only release flavours?

Upvotes: 25

Views: 75770

Answers (3)

dixit
dixit

Reputation: 81

If you want to upload the APK file to your firebase app distribtion, use the below command:

# generates debug signed APK
./gradlew assembleDebug

It will generate an APK file, but it couldn't be released to Play Store, as it signed with your debug signature. GPC won't allow it to be uploaded.

If you want to upload the APK or AAB file to Google Play Console, use one of the commands below:

# generates release signed APK
./gradlew assembleRelease
# generates release signed AAB
./gradlew bundleRelease

Upvotes: 8

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

You can run these commands:

assemble - Assembles all variants of all applications and secondary packages.
build - Assembles and tests this project.

If you want a specific flavor or buildtype use:

assembleDebug - Assembles all Debug builds.
assembleRelease - Assembles all Release builds.

In your case use:

./gradlew assembleRelease

Upvotes: 18

Alessandro Verona
Alessandro Verona

Reputation: 1257

Debug

./gradlew

Release

./gradlew assembleRelease

your gradle file should contains:

android {
   [...]
signingConfigs {
        release {
            storeFile file("../keystore.jks")
            storePassword "pwd"
            keyAlias "alias"
            keyPassword "pwd"
        }
    }

    buildTypes {

        release {
            signingConfig signingConfigs.release
        }
    }


   [...]
}

Upvotes: 27

Related Questions