After ADT17, there was a very interesting class, along with the APK:
The contents are as follows:
/**
* automatically generated file. Do not MODIFY
* *
package com.xuan.kotlinapp;
Public final class Buildconfig {public
static final Boolean DEBUG = Boolean.parseboolean ("true");
public static final String application_id = "Com.xuan.kotlinapp";
public static final String build_type = "Debug";
public static final String flavor = "GooglePlay";
public static final int version_code = 1;
public static final String version_name = "1.0";
Fields from builds Type:debug public
static Final Boolean api_version = true;
}
Of course, we can customize variables so that when the tool hits a different mode [Debug][release] version of the APK, it automatically assigns the corresponding value:
Syntax: buildconfigfiled "Variable type", "Variable name", "Variable Value"
You can also add parentheses such as: Buildconfigfield ("int", "BuildType", "1")
Here I demonstrate a custom global reshaping variable
Then click on the toolbar Build->build APK, which will generate the debug version of the Buildconfig global variable by default
When you package release version apk, the variable values in the configuration are also set:
You can reference the global variable value of the Buildconfig class in baseapplication or other classes to perform different logic
The most common applications
To control the corresponding log printing ...