{"id":25046037,"url":"https://github.com/wangchenyan/cfix","last_synced_at":"2025-06-22T19:35:26.931Z","repository":{"id":98874924,"uuid":"110973288","full_name":"wangchenyan/cfix","owner":"wangchenyan","description":"Android HotFix library forked from Nuwa","archived":false,"fork":false,"pushed_at":"2020-10-14T02:53:09.000Z","size":858,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T03:37:01.042Z","etag":null,"topics":["android","hotfix","nuwa"],"latest_commit_sha":null,"homepage":"https://juejin.im/post/6844903759462531086","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wangchenyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-16T13:14:27.000Z","updated_at":"2025-01-08T18:38:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"df33ab54-3fd5-4bb8-a0e1-aad2153b6d4c","html_url":"https://github.com/wangchenyan/cfix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wangchenyan/cfix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangchenyan%2Fcfix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangchenyan%2Fcfix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangchenyan%2Fcfix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangchenyan%2Fcfix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wangchenyan","download_url":"https://codeload.github.com/wangchenyan/cfix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangchenyan%2Fcfix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261352776,"owners_count":23146125,"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","hotfix","nuwa"],"created_at":"2025-02-06T06:34:27.569Z","updated_at":"2025-06-22T19:35:21.910Z","avatar_url":"https://github.com/wangchenyan.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cfix\n\n| 模块 | 最新版本 |\n|-|-|\n| cfix | [![cfix](https://api.bintray.com/packages/chanwong21/maven/cfix/images/download.svg)](https://bintray.com/chanwong21/maven/cfix/_latestVersion) |\n| cfix-gradle | [![cfix-gradle](https://api.bintray.com/packages/chanwong21/maven/cfix-gradle/images/download.svg)](https://bintray.com/chanwong21/maven/cfix-gradle/_latestVersion) |\n\n[手把手带你打造一个 Android 热修复框架](https://juejin.im/post/5c373a36e51d4552411abe88)\n\ncfix 是一个基于 [QQ 空间热修复方案](https://mp.weixin.qq.com/s/xuvHomyTzTA90IEWDrdwgw)打造的 Android 热修复框架。\n\n大量参考了 [Nuwa](https://github.com/jasonross/Nuwa)，可以说是 Nuwa 的衍生版，感谢 Nuwa 作者。\n\n## Features\n\n- 全面支持 Gradle 1.5.0-3.x 版本\n- 支持除 Application 之外的所有代码增删改\n- 不支持 AndroidManifest，因此不支持新增四大组件\n- 不支持资源修复\n- 支持补丁签名验证\n\n## Change Log\n\n`v1.1`\n- 新增支持 Gradle 3.x 版本\n\n`v1.0`\n- 第一个版本\n\n## Dependency\n\n1. Add gradle dependency\n\n```\n// root project build.gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n\n    dependencies {\n        classpath 'com.android.tools.build:gradle:3.1.4'\n        classpath 'me.wcy:cfix-gradle:1.1'\n    }\n}\n```\n\n2. Add library dependency \u0026 apply plugin\n\n```\n// module build.gradle\napply plugin: 'com.android.application'\napply plugin: 'me.wcy.cfix'\n\n...\n\ndependencies {\n    ...\n    compile 'me.wcy:cfix:1.0'\n}\n```\n\n3. Config\n\n```\n// module build.gradle\n...\napply plugin: 'me.wcy.cfix'\n\ncfix {\n    includePackage = ['me/wcy/cfix/sample']\n    excludeClass = ['me/wcy/cfix/sample/Exclude']\n    debugOn = true\n\n    sign = true\n    storeFile = file(\"release.jks\")\n    storePassword = 'android'\n    keyAlias = 'cfix'\n    keyPassword = 'android'\n}\n...\n```\n\n参数说明\n\n|参数名|作用|是否必须|备注|\n|:-- |:-- |:-- |:-- |\n| includePackage | 热修复包含的包名 | 否 | 如果不设置，默认将包含所有类，包括依赖的第三方库。建议设置为应用包名，如 `['me/wcy/cfix/sample', ...]` |\n| excludeClass | 热修复需要排除的类名 | 否 | 如果不设置将不排除任何类。示例 `['me/wcy/cfix/sample/Exclude', ...]` |\n| debugOn | Debug 模式是否开启热修复 | 否 | 默认打开 |\n| sign | 是否对 Patch 签名 | 否 | 默认关闭。如果开启签名，则需要配置以下4项，且需要和 APK 签名一致 |\n| storeFile | 签名文件 | 否 | 参考 signingConfigs |\n| storePassword | 密钥库密码 | 否 |  |\n| keyAlias | 证书别名 | 否 |  |\n| keyPassword | 证书密钥 | 否 |  |\n\n## Usage\n\n1. Init CFix in you Application\n\n```\n@Override\nprotected void attachBaseContext(Context base) {\n    super.attachBaseContext(base);\n    CFix.init(this);\n}\n```\n\n2. Load the patch file\n\n```\nCFix.loadPatch(patchFile, verify);\n```\n\n## ProGuard\n\nKeep cfix library\n\n```\n-keep class me.wcy.cfix.lib.** { *; }\n```\n\n## Generate Patch\n\n1. 打包后保存 CFix 输出文件，作为 Patch 的基准，位于\n\n```\nmodule/build/outputs/cfix\n```\n\n这里我们将 cfix 文件夹复制到 module 根目录\n\n2. 制作 Patch\n\nRun in terminal\n\n```\n./gradlew clean cfix${variant.name.capitalize()}Patch -P cfixDir=CFIX_OUTPUT_DIR\n\n例如\n./gradlew clean cfixDebugPatch -P cfixDir=/Users/wcy/Files/Android/AndroidStudioProjects/cfix/sample/cfix/\n```\n\n生成的 Patch 文件位于\n\n```\nmodule/build/outputs/cfix/${variant.dirName}/patch.jar\n```\n\n## Sample\n\n更多用法请参考 [Sample](https://github.com/wangchenyan/cfix/tree/master/sample)\n\n## About me\n\n掘金：https://juejin.im/user/2313028193754168\n\n微博：https://weibo.com/wangchenyan1993\n\n## License\n\n    Copyright 2017 wangchenyan\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangchenyan%2Fcfix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwangchenyan%2Fcfix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangchenyan%2Fcfix/lists"}