Android Studio: Build type release /debug - what relevance does this have?

后端 未结 1 1167
星月不相逢
星月不相逢 2021-01-18 13:48

I just created an apk via android studio and it gave me an option of creating my own key, which i did but then asked me what type of build it is i.e. debug or release. Also

相关标签:
1条回答
  • 2021-01-18 14:35

    The difference between debug and release builds is for example, that you can get the log output from the debug build but not from the release build.

    Debug builds can be signed with the default keystore, the release builds have to be signed with your created keystore.

    You can define the buildTypes in your App's module gradle. Here's an example:

        release {
            shrinkResources true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        debug {
            applicationIdSuffix ".debug"
        }
    

    Also you can define different flavors, like this:

    productFlavors {
        pro {
            applicationId = "xx.xxx.xxx.pro"
            signingConfig signingConfigs.Pro
        }
        lite {
            applicationId = "xx.xxx.xxx.lite"
            signingConfig signingConfigs.Lite
        }
    }
    

    This system makes it easier to create different apks from one Codebase (free or paid version, etc.)

    0 讨论(0)
提交回复
热议问题