How to set up gradle and android studio to do release build?

前端 未结 6 1994
礼貌的吻别
礼貌的吻别 2020-12-02 07:21

I want to build android app and start signing it. For that I need to have Release version of apk. Google documentation suggests only Eclipse and ant ways to have release bu

6条回答
  •  借酒劲吻你
    2020-12-02 07:45

    No need to update gradle for making release application in Android studio.If you were eclipse user then it will be so easy for you. If you are new then follow the steps

    1: Go to the "Build" at the toolbar section. 2: Choose "Generate Signed APK..." option. enter image description here

    3:fill opened form and go next 4 :if you already have .keystore or .jks then choose that file enter your password and alias name and respective password. 5: Or don't have .keystore or .jks file then click on Create new... button as shown on pic 1 then fill the form.enter image description here

    Above process was to make build manually. If You want android studio to automatically Signing Your App

    In Android Studio, you can configure your project to sign your release APK automatically during the build process:

    On the project browser, right click on your app and select Open Module Settings. On the Project Structure window, select your app's module under Modules. Click on the Signing tab. Select your keystore file, enter a name for this signing configuration (as you may create more than one), and enter the required information. enter image description here Figure 4. Create a signing configuration in Android Studio.

    Click on the Build Types tab. Select the release build. Under Signing Config, select the signing configuration you just created. enter image description here Figure 5. Select a signing configuration in Android Studio.

    4:Most Important thing that make debuggable=false at gradle.

        buildTypes {
            release {
               minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-  android.txt'), 'proguard-rules.txt'
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            zipAlignEnabled true
           }
         }
    

    visit for more in info developer.android.com

提交回复
热议问题