What is the difference between gradlew build and g

2020-06-08 14:20发布

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?

2条回答
Viruses.
2楼-- · 2020-06-08 15:12

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
查看更多
【Aperson】
3楼-- · 2020-06-08 15:21

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


   [...]
}
查看更多
登录 后发表回答