Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- dxt
- unreal_android_빌드옵션
- xcode_targeting
- cookcontent
- unity package_androidlib
- sourcetree_authencicationfailed
- owasp_dependency_check
- asset database_androidlib
- appcenter대체
- molocon24후기
- Unity2022
- jenkins_role관리_플러그인
- unreal_flavorselection
- apkipa업로드저장소
- unrealbuildshellscript
- python_distutils_module_missing
- sourcetree_accessdenied
- xcode-select_jeknins
- unreal_contentmanagement
- molocon24내용정리
- ChatGPT
- etc2
- python3.12.4
- unreal_binaryselection
- jenkins_sudo
- molocon24
- jenkins_계정삭제
- owasp_depdendency_check_shell
- unrealbuildcommand
- jenkins_owasp
Archives
- Today
- Total
mystic-agit 개발 블로그
[Android] Proguard 난독화 설정 (aar 라이브러리에 난독 설정 사전 포함하기) 본문
Android 라이브러리 프로젝트 빌드 시 산출물로 .aar 파일을 구성할 수 있고 이때 난독화 설정으로 내 코드를 변조시킬 수 있다. 반면에 난독화 설정에서 일부 코드는 외부에서 접근가능하도록 공개하여 난독이 발생하지 않게 할 수 있다.
Android 프로젝트에선 build.gradle 내에서 proguard 설정을 통해 난독화를 진행할 수 있고 aar 빌드 도움이 되었던 몇 가지 옵션을 기록하였다.
(1) proguardFile
// build.gradle 에서
buildTypes {
release {
minifyEnable true
proguardFile ‘proguard_rules.pro’ // 임의 정의한 파일
}
}
// or
buildTypes {
release {
minifyEnable true
proguardFiles ‘proguard_rules.pro’, ‘proguard_rules-ex.pro’ // 임의 정의한 파일들
}
}
- 현재 프로젝트에서 빌드할 라이브러리(.aar) 혹은 애플리케이션(.apk)에 적용 가능
- minifyEnable true 옵션과 함께 사용
(2) consumerProguardFile
// build.gradle 에서
defaultConfig {
…
consumerProgardFiles ‘consumer-rules.pro’, ‘consumer-rules-ex.pro’
}
// or
buildTypes {
release {
…
consumerProgardFiles ‘consumer-rules.pro’, ‘consumer-rules-ex.pro’
}
}
- 라이브러리 프로젝트에 설정 가능하며 해당 라이브러리를 사용하는 apk에 난독화가 반영됨
- 애플리케이션 프로젝트에서 단독 사용 시 반영되지 않음
- 해당 설정으로 라이브러리(.aar)이 난독화되지 않음
- 선언된 내용은 라이브러리(.aar) 빌드 시 proguard.txt 파일에 추가됨 (Android Studio를 통해 디컴파일 시 확인 가능)
- 여러 proguard 파일을 사용하는 경우 하나의 txt 파일로 병합
- 라이브러리 빌드 시 minifyEnable 옵션과 사용되지 않아도됨
- 애플리케이션 빌드 시 buildTypes 설정에서 minifyEnable true 설정이 되어 있어야 라이브러리(.aar)에 포함된 consumerProguardFile 설정도 반영됨
'Android > Utility' 카테고리의 다른 글
Android aab 파일을 apk 파일로 변경하기 (0) | 2023.03.24 |
---|
Comments