투케이2K

619. (Android/Java) 안드로이드 BuildConfig 빌드콘피그 사용해 앱 빌드 설정 값 확인 - APPLICATION_ID , VERSION , BUILD_TYPE 본문

Android

619. (Android/Java) 안드로이드 BuildConfig 빌드콘피그 사용해 앱 빌드 설정 값 확인 - APPLICATION_ID , VERSION , BUILD_TYPE

투케이2K 2023. 8. 2. 20:43

[개발 환경 설정]

개발 툴 : AndroidStudio

 

[소스 코드]

        // ---------------------------------------------------------------
        // [로직 처리 실시]
        // ---------------------------------------------------------------
        try {

            // [BuildConfig : 앱 빌드 설정 값 확인]
            String applicationId = BuildConfig.APPLICATION_ID;
            String versionCode = String.valueOf(BuildConfig.VERSION_CODE);
            String versionName = BuildConfig.VERSION_NAME;
            String buildType = BuildConfig.BUILD_TYPE;
            String debug = String.valueOf(BuildConfig.DEBUG);


            // [로그 출력]
            S_Log._W_("BuildConfig : 앱 빌드 설정 값 확인", new String[]{
                    "applicationId :: " + applicationId,
                    "versionCode :: " + versionCode,
                    "versionName :: " + versionName,
                    "buildType :: " + buildType,
                    "debug :: " + debug
            });

        }
        catch (Exception e) {
            S_Log._printStackTrace_(A_Intro.this, "로직 처리 수행 에러", null, e);
        }
 

[결과 출력]

 

W///===========//: ================================================
I/: [LOG :: CLASS PLACE :: com.example.javaproject.A_Intro.onCreate(A_Intro.java:259)]
I/: ----------------------------------------------------
I/: [LOG :: NOW TIME :: 2023-08-02 08:42:05 수요일]
I/: ----------------------------------------------------
I/: [LOG :: DESCRIPTION :: BuildConfig : 앱 빌드 설정 값 확인]
I/: ----------------------------------------------------
I/: [LOG :: applicationId :: com.example.javaproject]
I/: ----------------------------------------------------
I/: [LOG :: versionCode :: 1]
I/: ----------------------------------------------------
I/: [LOG :: versionName :: 1.0.0]
I/: ----------------------------------------------------
I/: [LOG :: buildType :: debug]
I/: ----------------------------------------------------
I/: [LOG :: debug :: true]
W///===========//: ================================================

 

반응형
Comments