What is the difference between gradlew build and gradlew assembleRelease

纵饮孤独 提交于 2019-12-04 17:06:27

问题


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?


回答1:


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
        }
    }


   [...]
}



回答2:


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


来源:https://stackoverflow.com/questions/40219917/what-is-the-difference-between-gradlew-build-and-gradlew-assemblerelease

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!