Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Modularization with Dynamic Feature Module

115 views

Published on

NAVER Android Meet up 발표자료 : Modularization with Dynamic Feature Module

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Modularization with Dynamic Feature Module

  1. 1. Modularization with Dynamic Feature Module (feat. App Bundle Tip) 2019.06.25 네이버앱 개발 이강
  2. 2. 모듈화란?
  3. 3. 네이버에는 현재 수많은 앱들이 존재합니다.
  4. 4. 그리고 네이버는 올 해 20주년을 맞이했습니다.
  5. 5. App
  6. 6. 모듈화.... 왜?
  7. 7. 1. Scale
  8. 8. App
  9. 9. App
  10. 10. 2. Maintainability
  11. 11. 3. Build Times
  12. 12. 4. App Size
  13. 13. • On-demand delivery : Out of Beta • Conditional delivery : New Feature
  14. 14. Modularization with Dynamic Feature Module
  15. 15. :app apply plugin: ‘com.android.application’ :library 1 apply plugin: ‘com.android.library’ :library 2 apply plugin: ‘com.android.library’
  16. 16. :app apply plugin: ‘com.android.application’ :DFM 1 apply plugin: 'com.android.dynamic-feature' :DFM 2 apply plugin: 'com.android.dynamic-feature' :app can’t depend on :DFM1/2
  17. 17. :app apply plugin: ‘com.android.application’ :DFM 1 onDemand=”false” apply plugin: 'com.android.dynamic-feature' :DFM 2 onDemand=”true” apply plugin: 'com.android.dynamic-feature'
  18. 18. onDemand=“true”
  19. 19. onDemand=“true”
  20. 20. onDemand=“true” 80/20
  21. 21. :app :DFM 1 :DFM 2
  22. 22. :app :library :DFM 2:DFM 1
  23. 23. :app :library :DFM 2:DFM 1 :base (core)
  24. 24. Navigation
  25. 25. :app :library :DFM 2:DFM 1 :base (core) startActivity() val intent = Intent(this, DFM2Activity::class.java) startActivity(intent) val intent = Intent(Intent.ACTION_VIEW).setClassName( PACKAGE_NAME, FULL_CLASS_NAME) startActivity(intent)
  26. 26. :app :library :DFM 2:DFM 1 :base (core) fun <T> loadClassOrNull(className: String): Class<T>? { return CLASS_MAP.getOrPut(className) { try { Class.forName(className) } catch (e: ClassNotFoundException) { return null } }.castOrNull() Intent return nullable!! > Dynamic Feature (onDemand) > Debug Build (doesn’t exist in the flavor)
  27. 27. • Jetpack Navigation 지원 예정?
  28. 28. Dependencies
  29. 29. :app :search:video :base (core) :news SearchActivity
  30. 30. :search :video:news
  31. 31. :base (core) DataSource :search :video:news
  32. 32. :base (core) DataSource :search :video VideoDataSource :news NewsDataSource
  33. 33. :base (core) DataSource :search Set<DataSource> :video VideoDataSource :news NewsDataSource
  34. 34. :base (core) DataSource :search Set<DataSource> :video VideoDataSource :news NewsDataSource // :base Interface DataSourceProvider { fun getDataSource(context: Context) : DataSource } // :news class NewsDataSourceProvider : DataSourceProvider { override fun getDataSource(context: Context) : DataSource { // build dependencies return dataSource } } // :search fun dataSource(activity: Activity) : Set<DataSource> { val dataSources = mutableSetOf<DataSource>() if (isFeatureInstalled(…)) { val provider = Class.forName(“…NewsDataSourceProvider”) .newInstance() as DataSourceProvider val dataSource = provider.getDataSource(activity) dataSources.add(dataSource) } }
  35. 35. :base (core) DataSource :search Set<DataSource> :video VideoDataSource :news NewsDataSource // :search val manager: SplitInstallManager .. manager.registerListener(listener) val listener = SplitInstallStateUpdatedListener { state -> if (SplitInstallSessionStatus.INSTALLED == state) { // module was installed val newDataSource = getDataSource( … ) registry.add(newDataSource) } } onDemand=“true”로 아직 다운로드 전이라면? • ServiceLoader • Dagger
  36. 36. • 모듈화에 정답은? • 그렇다면 모듈화는 정말로 해야하는가?
  37. 37. App Bundle 적용기
  38. 38. • App Bundle의 적용 자체는 간단하지만 이후 검증 및 배포 프로세스의 변경 필요
  39. 39. • Google Play Console upload track? 1) Production Track 2) Beta Track 3) Internal Test Track
  40. 40. • Google Play Console upload track? 1) Production Track 2) Beta Track 3) Internal Test Track 4) Internal Sharing
  41. 41. • Internal Sharing 참고사항 1. 설치하려는 단말의 Play Store 설정에서 ‘내부 앱 공유’ enable 2. signing : Google Internal Key Ø 기존 앱에 업데이트 설치 불가
  42. 42. • App Bundle 적용 후 이슈 1) Native Library Crash • 재현 : App Bundle 설치 > apk sdcard로 이동 > Crash 위 옵션 설정 시 아래 warning 발생하지만 Google 측에 문의한 결과 경고 메시지는 곧 사라질 예정 - The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
  43. 43. • App Bundle 적용 후 이슈 2) Resources NotFoundException - 특정 단말에서 반복적으로 발생 : 앱 진입 불가 - 백업/복구 어플 또는 apk 추출 어플 통해 수동으로 설치하는 경우에 발생 > base.apk 만 설치되고 resource, cpu 등의 split apk는 설치되지 않아 크래시 발생
  44. 44. 감사합니다

×