A Guide to Android Plug-in Development cover

A Guide to Android Plug-in Development

Rating 4.0
Word count
334K words
Chapters
24
Series
Hua Zhang Tech · Mobile Development
ISBN
9787111603368

Tags

Summary

A Guide to Android Plug-in Development is an advanced technical monograph for Android engineering by Bao Jianqiang, published by China Machine Press in 2018 as part of the "HZ Books · Mobile Development" series. The book argues that the core value of plug-in technology lies in letting an app fix online bugs or ship new features without releasing a new version—significantly shortening iteration cycles and cutting release costs for apps with millions to tens of millions of daily active users. The book has 22 chapters in three parts. Part One, "Preliminary Knowledge" (Chapters 1–5), introduces the history and current state of plug-in technology and systematically lays out Android's underlying mechanisms, including Binder and AIDL principles, AMS and the workings of the four major components, the app installation and launch process, the family relationships of Context and ClassLoader, parent delegation and MultiDex, and reflection, dynamic proxies, and hooking startActivity. Part Two, "Solutions" (Chapters 6–16), starts from basic problems such as loading external dex, interface-oriented programming, and resource loading and skinning, then gives plug-in solutions for each of the four major components—Activity, Service, BroadcastReceiver, and ContentProvider—and analyzes the static-proxy approach of the that framework as well as a Fragment-based plug-in framework. Part Three, "Related Technologies" (Chapters 17–22), discusses degradation, plug-in obfuscation, incremental updates, plug-in solutions for so files, and hooking the app packaging process, and concludes with a summary of plug-in technology. The author emphasizes that the book avoids long source-code listings, instead using numerous UML diagrams to connect the underlying knowledge and help readers understand fundamentally why plug-in technology is feasible.

Editor's review

很多 Android 开发者理解插件化,是从“占坑”“Hook”“改 ClassLoader”这些零散关键词开始的,结果是能照着改代码,却说不清为什么可行。这本书难得之处在于,它先花五章篇幅把地基打牢:Binder 与 AIDL、AMS、四大组件、Context 与 ClassLoader 家族、双亲委托与 MultiDex,一张张 UML 图把链条串起来,然后再谈方案。中段按组件分章拆解 Activity、Service、BroadcastReceiver、ContentProvider 的插件化路径,并对比 that 框架的静态代理思路,读者可以顺着“问题—方案—局限”的脉络建立判断力。后段把降级、混淆、增量更新、so 插件化、打包流程 Hook 这些工程落地绕不开的周边技术补齐,最后以总结收束。需要提醒的是,本书成书于 2018 年,讨论的是传统插件化路线,且部分框架与方案已发生演进;它更适合当作理解原理和设计思想的教材,而非最新 API 的手册。

Who it's for

A good fit for

  • 有 2 年以上 Android 开发经验、想深入理解系统底层机制的工程师
  • 负责大型 App 架构与发版效率、需要评估热修复与插件化方案的技术负责人
  • 准备面试或系统复习 Android 四大组件、ClassLoader、Binder 知识的开发者
  • 想借鉴 Hook 与代理思想来解决其他平台热更新问题的技术人员

Not a good fit for

  • 零基础或刚入门的 Android 学习者,缺少足够代码经验很难跟上
  • 只想要开箱即用框架和最新 API 示例、不愿读原理的人
  • 从事 iOS、后端等方向、对 Android 系统机制无需求的读者

Reading tips

  1. 先通读第 2 章 Android 底层知识,把 Binder、四大组件、ClassLoader 的脉络梳理清楚再进入方案部分。
  2. 阅读方案章节时,边读边动手复现书中示例工程,重点体会“声明占位—动态替换—资源加载”的主线。
  3. 把第 17~21 章的降级、混淆、增量更新当作工程清单,对照自己项目的发版流程逐项核对。
  4. 注意书成于 2018 年,遇到框架细节与现行版本不一致时,以官方文档和最新源码为准。

About the publisher

China Machine Press China · Founded in 1950

In addition to science and technology and professional publishing, the books in our catalog from China Machine Press also reflect a sustained focus on psychology, computing, management, finance and economics, and social sciences. In psychology, the catalog includes works by C. G. Jung and introductions to analytical psychology, as well as applied topics such as stress and health, and addiction and healing. In computing, it features Structure and Interpretation of Computer Programs (JavaScript Edition). Management and finance titles include Administrative Behavior (4th Edition), The Price of Inequality (Collector's Edition), and This Time Is Different: Eight Centuries of Financial Folly (Commemorative Edition). In the philosophy and history of science, there is The Worldview: The Third Edition. Relevant authors include C. G. Jung, William McGuire, Sonu Shamdasani, and Gabor Maté. Public information is limited; the above summarizes the publisher's profile based solely on the books in our catalog.

Contents

  1. Chapter 1 The Past, Present, and Future of Plug-in Technology
  2. Chapter 2 Android Fundamentals
  3. Chapter 3 Reflection
  4. Chapter 4 The Proxy Pattern
  5. Chapter 5 Hooking the startActivity Method
  6. Chapter 6 Basics of Plug-in Technology
  7. Chapter 7 A First Look at Resources
  8. Chapter 8 The Simplest Plug-in Solution
  9. Chapter 9 Plug-in Solutions for Activity
  10. Chapter 10 Plug-in Solutions for Service
  11. Chapter 11 Plug-in Solutions for BroadcastReceiver
  12. Chapter 12 Plug-in Solutions for ContentProvider
  13. Chapter 13 A Static-Proxy Plug-in Solution: The that Framework
  14. Chapter 14 The that Framework's Support for Service and BroadcastReceiver
  15. Chapter 15 Resources Revisited
  16. Chapter 16 A Fragment-Based Plug-in Framework
  17. Chapter 17 Degradation
  18. Chapter 18 Obfuscating Plug-ins
  19. Chapter 19 Incremental Updates
  20. Chapter 20 Plug-in Solutions for so Files
  21. Chapter 21 Hooking the App Packaging Process
  22. Chapter 22 Summary of Plug-in Technology
  23. Appendix A Common Tools
  24. Appendix B Code Index for This Book

FAQ

这本书适合什么水平的 Android 开发者?
更适合有两年以上实际开发经验、熟悉四大组件基本用法的工程师。书中大量内容涉及反射、动态代理、Binder 与 ClassLoader 机制,零基础读者容易在预备知识部分卡住。如果只是想快速接入现成方案,建议先补基础再读。
书里的插件化方案现在还能直接用吗?
书出版于 2018 年,讨论的是传统插件化路线,包括占坑、动态代理、替换 ClassLoader 等思路,这些原理至今仍是理解热修复与动态加载的基础。但具体框架版本、Android 系统限制(如高版本对非公开 API 的限制)已有变化,落地前需对照现行官方规范重新验证。
全书共多少章,结构是怎样的?
全书共 22 章,分三部分:第 1~5 章为预备知识,讲插件化历史与 Android 底层机制;第 6~16 章为解决方案,按四大组件分别给出插件化路径并剖析 that 等框架;第 17~22 章为相关技术,涵盖降级、混淆、增量更新、so 插件化与打包流程 Hook,最后是总结。
插件化和热修复是同一件事吗?
两者相关但不等同。热修复侧重在不发版的情况下替换或修补已有代码;插件化则更强调把功能模块独立打包、按需加载与运行。书中把插件化定位为既能修 Bug 又能快速上线新功能的手段,并在周边技术章节讨论降级、增量更新等配套做法。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category