简体   繁体   English

gradlew build和gradlew assemble有什么区别

[英]What is the difference between gradlew build and gradlew assembleRelease

I want to build apk from command line with the help of gradle. 我想在gradle的帮助下从命令行构建apk。 Which command should I use to build apks for only release flavours? 我应该使用哪个命令来构建仅用于发行版本的apk?

Debug 除错

./gradlew

Release 发布

./gradlew assembleRelease

your gradle file should contains: 您的gradle文件应包含:

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

    buildTypes {

        release {
            signingConfig signingConfigs.release
        }
    }


   [...]
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM