Build within the project
buildTypes{
release {
miniEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
manifestPlaceholders=[appVersion:""];
}
staging{
applicationIdSuffix'.staging'
versionNameSuffix '-staging'
manifestPlaceholders = [appVersion: "-stg" ];
}
debug {
applicationIdSuffix'.debug'
versionNameSuffix '-debug'
manifestPlaceholders = [appVersion: "-debug" ];
}
}
US>productFlavors {
US>panel{
versionCode2
versionName '1.1'
applicationIdSuffix'.panel'
manifestPlaceholders = [appName: "gathereapp-panel" ]
}
admin{
manifestPlaceholders = [appName: "gathereapp";
}
}
I divided it up like this, but
I would like to specify variables and methods for each build.
For XCode, link here.
Can Android Studio create and utilize a configuration file like this?
I've never used it myself, but I guess it's like this.
The above is described in "defaultConfig", but if you write buildConfigField in each buildType, you can do what you want.
buildTypes{
release {
miniEnabled false
US>proguardFiles.add(file('proguard-android.txt')
buildConfigField "String", "hoge", "\"Hello, world!\""
}
debug {
buildConfigField "String", "hoge", "\"Hello, debug world!\""
}
}
When I debugged build with the above description in build.gradle, I got the following source: build/generated/source/buildConfig/debug/com/example/test1214/buildConfig.java.
/**
* Automatically generated file.DO NOT MODIFY
*/
package com.example.test1214;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.test1214";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR="";
public static final int VERSION_CODE=1;
public static final String VERSION_NAME = "0.1";
// Fields from build type: debug
public static final String hoge="Hello, debug world!";
}
© 2024 OneMinuteCode. All rights reserved.