Gradle 지식
우선 응용 프로그램 Id Suffix를 사용하여 응용 프로그램 Id를 수정합니다. 이 수정을 완성하면 개발과 온라인 버전이 공존할 수 있습니다. 그러나 이것은 가장 초보적인 수정입니다. 변형 폴더에 맞추어 서로 다른 환경의 코드와 운행 자원을 만들고 개발과 온라인 버전을 구분하여 많은 목적을 달성할 수 있습니다.
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-rules.txt'
shrinkResources true // keep
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles 'proguard-rules.txt'
shrinkResources false // keep
signingConfig signingConfigs.release
//
applicationIdSuffix ".debug"
}
}
${applicationId}
로 대체하고 컴파일러는 자동으로 실제 값android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "app-${variant.baseName}-${variant.versionName}.apk"
}
}
Gradle 사용자 정의 플러그인 컴파일 중 설정 오류 읽기
문제가 발생했습니다. 주로Gradle 스크립트의 실행 과정에 관한 문제입니다. 근원은 설정을 읽을 때의 문제입니다.
A Gradle build has three distinct phases.
InitializationGradle
supports single and multi-project builds. During the initialization phase, Gradle determines which projects are going to take part in the build, and creates a Project instance for each of these projects.
Configuration
During this phase the project objects are configured. The build scripts of all projects which are part of the build are executed.
ExecutionGradle
determines the subset of the tasks, created and configured during the configuration phase, to be executed. The subset is determined by the task name arguments passed to the gradle command and the current directory. Gradle then executes each of the selected tasks.
설정 과정에서 관련 설정 정보를 얻는 값은 비어 있습니다. 정확한 획득 시기는 Configuration이 끝난 후 (project.after Evaluate) 실행해서 논리를 얻는 것입니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.