Android
Build Variant( 빌드 변형 ) 설정
단돈백이원
2022. 5. 17. 08:16
- https://developer.android.com/studio/build/build-variants?hl=ko
- 모듈 레벨
build.gradle
파일의android
블록 내에 빌드 유형을 생성하고 구성할 수 있습니다.
android {
defaultConfig {
manifestPlaceholders = [hostName:"www.example.com"]
...
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".debug"
debuggable true
}
/**
* The `initWith` property allows you to copy configurations from other build types,
* then configure only the settings you want to change. This one copies the debug build
* type, and then changes the manifest placeholder and application ID.
*/
staging {
initWith debug
manifestPlaceholders = [hostName:"internal.example.com"]
applicationIdSuffix ".debugStaging"
}
}
}
- https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html 에 나와있는 빌드 설정 블록.
- buildTypes 블록은 어플리케이션이 어떤 목적으로 빌드될 것인지를 설정하는 설정사항이다.
- signingConfigs 블록은 앱을 어떤 패키지로 빌드할 것인지 설정하기 위해 미리 정의하는 속성 리스트다.
- signingConfigs에
- 앱의 빌드 속성을 변경하여 다른 빌드경로 / 빌드 리소스를 사용할 수 있게하는 속성이다.
- ex)
- Android Studio의 Project Perspective중 Project를 선택하면 src아래에 각 buildType별 리소스를 override할 수 있다.