Android Studio: how to generate signed apk using Gradle?

前端 未结 5 1136
一个人的身影
一个人的身影 2020-12-07 09:21

I\'ve searched on Google and SO but cannot find my answer.

This is the first time I\'m working with the gradle system and I am now at the point of generating a signe

5条回答
  •  醉酒成梦
    2020-12-07 09:52

    There are three ways to generate your build as per the buildType. (In your case, it's release but it can be named anything you want.)

    1. Go to Gradle Task in right panel of Android Studio and search for assembleRelease or assemble(#your_defined_buildtype) under Module Tasks

    2. Go to Build Variant in Left Panel and select the build from drop down

    3. Go to project root directory in File Explore and open cmd/terminal and run:

      Linux: ./gradlew assembleRelease or assemble(#your_defined_buildtype)

      Windows: gradlew assembleRelease or assemble(#your_defined_buildtype)

    If you want to do a release build (only), you can use Build > Generate Signed apk. For other build types, only the above three options are available.

    You can find the generated APK in your module/build directory having the build type name in it.

提交回复
热议问题