{"id":15032944,"url":"https://github.com/luojilab/ddcomponentforandroid","last_synced_at":"2025-04-14T04:13:49.372Z","repository":{"id":58183312,"uuid":"102696598","full_name":"luojilab/DDComponentForAndroid","owner":"luojilab","description":"一套完整有效的android组件化方案，支持组件的组件完全隔离、单独调试、集成调试、组件交互、UI跳转、动态加载卸载等功能","archived":false,"fork":false,"pushed_at":"2020-08-05T03:14:22.000Z","size":1060,"stargazers_count":3334,"open_issues_count":26,"forks_count":570,"subscribers_count":105,"default_branch":"master","last_synced_at":"2025-04-14T04:13:46.808Z","etag":null,"topics":["android","android-application","android-architecture","android-component"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luojilab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-07T05:48:44.000Z","updated_at":"2025-04-12T10:01:56.000Z","dependencies_parsed_at":"2022-09-25T06:20:48.251Z","dependency_job_id":null,"html_url":"https://github.com/luojilab/DDComponentForAndroid","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luojilab%2FDDComponentForAndroid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luojilab%2FDDComponentForAndroid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luojilab%2FDDComponentForAndroid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luojilab%2FDDComponentForAndroid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luojilab","download_url":"https://codeload.github.com/luojilab/DDComponentForAndroid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819405,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-application","android-architecture","android-component"],"created_at":"2024-09-24T20:19:47.390Z","updated_at":"2025-04-14T04:13:49.346Z","avatar_url":"https://github.com/luojilab.png","language":"Java","readme":"## DDComponent\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/luojilab/DDComponentForAndroid/pulls)\n[![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg)](https://github.com/luojilab/DDComponentForAndroid/blob/master/LICENSE) \n\n### 实现功能：\n- 组件可以单独调试\n- 杜绝组件之前相互耦合，代码完全隔离，彻底解耦\n- 组件之间通过接口+实现的方式进行数据传输\n- 使用scheme和host路由的方式进行activity之间的跳转\n- 自动生成路由跳转路由表\n- 任意组件可以充当host，集成其他组件进行集成调试\n- 可以动态对已集成的组件进行加载和卸载\n- 支持kotlin组件\n\n### 使用指南\n#### 1、主项目引用编译脚本\n在根目录的gradle.properties文件中，增加属性：\n\n```ini\nmainmodulename=app\n```\n其中mainmodulename是项目中的host工程，一般为app\n\n在根目录的build.gradle中增加配置\n\n```gradle\nbuildscript {\n    dependencies {\n        classpath 'com.luojilab.ddcomponent:build-gradle:1.2.0'\n    }\n}\n```\n\n为每个组件引入依赖库，如果项目中存在basiclib等基础库，可以统一交给basiclib引入\n\n```gradle\ncompile 'com.luojilab.ddcomponent:componentlib:1.3.0'\n```\n\n#### 2、拆分组件为module工程\n在每个组件的工程目录下新建文件gradle.properties文件，增加以下配置：\n\n```ini\nisRunAlone=true\ndebugComponent=sharecomponent\ncompileComponent=sharecomponent\n```\n上面三个属性分别对应是否单独调试、debug模式下依赖的组件，release模式下依赖的组件。具体使用方式请解释请参见上文第二篇文章\n\n#### 3、应用组件化编译脚本\n在组件和host的build.gradle都增加配置：\n\n```gradle\napply plugin: 'com.dd.comgradle'\n```\n\n注意：不需要在引用com.android.application或者com.android.library\n\n同时增加以下extension配置：\n\n```gradle\ncombuild {\n    applicationName = 'com.luojilab.reader.runalone.application.ReaderApplication'\n    isRegisterCompoAuto = true\n}\n```\n组件注册还支持反射的方式，有关isRegisterCompoAuto的解释请参见上文第二篇文章\n\n#### 4、混淆\n在混淆文件中增加如下配置\n```\n-keep interface * {\n  \u003cmethods\u003e;\n}\n-keep class com.luojilab.component.componentlib.** {*;}\n-keep class com.luojilab.router.** {*;}\n-keep class com.luojilab.gen.** {*;}\n-keep class * implements com.luojilab.component.componentlib.router.ISyringe {*;}\n-keep class * implements com.luojilab.component.componentlib.applicationlike.IApplicationLike {*;}\n```\n\n关于如何进行组件之间数据交互和UI跳转，请参看 [Wiki](https://github.com/luojilab/DDComponentForAndroid/wiki)\n\n\n### License\n\nDDComponentForAndroid 使用的 MIT 协议，详细请参考 [LICENSE](https://github.com/luojilab/DDComponentForAndroid/blob/master/LICENSE.md)。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluojilab%2Fddcomponentforandroid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluojilab%2Fddcomponentforandroid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluojilab%2Fddcomponentforandroid/lists"}