Android Studio:构建类型发布/调试 - 这有什么相关性? [英] Android Studio: Build type release /debug - what relevance does this have?

查看:32
本文介绍了Android Studio:构建类型发布/调试 - 这有什么相关性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚通过 android studio 创建了一个 apk,它给了我一个创建自己的密钥的选项,我做到了,但后来问我它是什么类型的构建,即调试或发布.还有口味列表,不存在.

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 list of flavours, which none exists.

这个信息设置在哪里,在gradle文件中?

Where is this information setup, in the gradle file ?

因此,如果我将构建类型设置为发布,这有什么相关性.

So if I leave build type set to Release, what relevance does this have.

我在获取有关此的任何文档时遇到问题.

I am having problems sourcing any documentation on this.

有什么想法吗?

推荐答案

例如,调试版本和发布版本的区别在于,您可以从调试版本获取日志输出,但不能从发布版本获取日志输出.

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.

您可以在应用的模块 gradle 中定义 buildType.举个例子:

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

该系统使从一个代码库(免费或付费版本等)创建不同的 apk 变得更加容易

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

这篇关于Android Studio:构建类型发布/调试 - 这有什么相关性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆