{"id":20719957,"url":"https://github.com/ximsfei/stark","last_synced_at":"2025-04-09T12:09:01.402Z","repository":{"id":127104015,"uuid":"134016527","full_name":"ximsfei/Stark","owner":"ximsfei","description":"Stark is a hot-fix framework for Android. It supports swapping new implementations of classes without restarting a running Android application, and updated Android resources (icons, layout, etc) while only restarting the Android Activity. Most importantly, there is no private API invoked in Stark.","archived":false,"fork":false,"pushed_at":"2019-08-14T18:02:05.000Z","size":397,"stargazers_count":364,"open_issues_count":8,"forks_count":49,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-02T11:04:07.882Z","etag":null,"topics":["android","gradle","hot-fix","patch"],"latest_commit_sha":null,"homepage":"","language":"Java","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/ximsfei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2018-05-19T00:38:05.000Z","updated_at":"2024-07-29T05:33:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d3acb85-ccb0-453f-bde2-f4079f20f184","html_url":"https://github.com/ximsfei/Stark","commit_stats":{"total_commits":63,"total_committers":1,"mean_commits":63.0,"dds":0.0,"last_synced_commit":"3824aacdbda7af2f7a895b335c5b4f816e23fb2c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ximsfei%2FStark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ximsfei%2FStark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ximsfei%2FStark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ximsfei%2FStark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ximsfei","download_url":"https://codeload.github.com/ximsfei/Stark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"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","gradle","hot-fix","patch"],"created_at":"2024-11-17T03:18:55.456Z","updated_at":"2025-04-09T12:09:01.375Z","avatar_url":"https://github.com/ximsfei.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](logo.png)\n\n[![release](https://img.shields.io/badge/release-0.0.5-green.svg)](http://jcenter.bintray.com/com/ximsfei/stark)\n![build](https://img.shields.io/badge/build-passing-green.svg)\n![pr](https://img.shields.io/badge/PRs-welcome-blue.svg)\n[![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](#license)\n\nStark is a hot-fix framework for Android. It supports swapping new implementations of classes without restarting a running Android application, and updated Android resources (icons, layout, etc) while only restarting the Android Activity.\n\n## Sample Usage\n\n1. git clone https://github.com/ximsfei/Stark.git\n2. cd Stark\n3. ./gradlew :stark-sample:clean :stark-sample:assembleDebug\n4. adb install -r stark-sample/build/outputs/apk/debug/stark-sample-debug.apk\n5. Launch sample APK.\n6. Fix code and resources.\n\nFix Code\n\n\u003e SecondActivity.java\n\n```java\npublic class SecondActivity extends Activity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        content.setText(\"Code bug\");\n//        content.setText(\"aha, Code Bug Fix\");\n//        Toast.makeText(this, \"fixed\", Toast.LENGTH_SHORT).show();\n    }\n}\n```\n\nFix Resources\n\n\u003e strings.xml\n\n```xml\n    \u003cstring name=\"fix_text\"\u003eResources bug\u003c/string\u003e\n    \u003c!--\u003cstring name=\"fix_text\"\u003eAha, Resources Bug Fix\u003c/string\u003e--\u003e\n```\n\nChange the `TextView` in activity_main.xml and activity_second.xml to `Button`.\n\n7. ./gradlew :stark-sample:clean :stark-sample:starkGeneratePatchDebug\n8. adb push stark-sample/build/outputs/apk/debug/stark-sample-debug.patch /sdcard/Android/data/com.ximsfei.stark.app/fix.apk\n9. Launch sample APK.\n10. Click the Button of applyPatch.\n11. Click the Button of recreate.\n12. Observe whether the code and resources are fixed.\n\n## Getting Started\n\nThe Gradle Dependency is available via [jCenter](https://bintray.com/pengfeng/ximsfei),\n\nFirstly, add dependency directly in your root project's build.gradle:\n\n```gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.ximsfei:stark-gradle:0.0.5'\n    }\n}\n```\n\nSecondly, apply `com.ximsfei.stark` plugin and add stark core dependencies in your Android application project's build.gradle:\n\n```gradle\napply plugin: 'com.android.application'\napply plugin: 'com.ximsfei.stark'\n\ndependencies {\n    implementation 'com.ximsfei:stark-core:0.0.5'\n    implementation 'io.sigpipe:jbsdiff:1.0'\n}\n```\n\n*Note: Stark depends on jbsdiff, you need add jbsdiff dependency in your build.gradle*\n\nInitialize stark framework in application's `attachBaseContext`:\n\n```java\npublic class YourApp extends Application {\n    @Override\n    protected void attachBaseContext(Context base) {\n        super.attachBaseContext(base);\n        Stark.get().load(base);\n    }\n}\n```\n\nAfter got the patch file, invoke the `applyPatchAsync` method to apply patch.\n\n```java\npublic class AnyClass {\n    public void applyPatch(Context context, String path) {\n        Stark.get().applyPatchAsync(context, path);\n    }\n}\n```\n\nAfter adding the dependencies and apply plugin, refresh gradle project, stark plugin will add two more tasks for you:\n\nYou can find them in the gradle stark task group.\n\n1. starkBackup + BuildType\n\nAfter running the `assemble + BuildType`, run the backup task can backup the files needed to generate the patch for you.\n\nEven you can enable an automatic backup configuration in the [stark.properties](#configuration-files) file. \n\n2. starkGeneratePatch + BuildType\n\nWhen you find a bug in an online apk, you can fix the code and run the `starkGeneratePatch + BuildType` task to generate hot-fix patch.\n\nThe `starkGeneratePatch + BuildType` task relies on files backed up by the `starkBackup + BuildType` task.\n\n## ProGuard\n\n```pro\n-keep class com.ximsfei.stark.core.runtime.** {public *;}\n```\n\n## Configuration files\n\nAlso, the stark plugin will generate two configuration files in your Android application project dir:\n\n\u003e stark.properties\n\n```properties\n# If autoBackup is true.\n# Stark plugin will automatically backup the files needed to generate the patch.\n# Otherwise, you need to run the stark backup task manually.\nautoBackup=false\n\n# If allStark is true.\n# Stark plugin will inject redirection code into all BuildType(debug/release).\n# You'd better disable this configuration at the development stage.\nallStark=false\n\n# If releaseStark is true.\n# Stark plugin will inject redirection code into release stage.\nreleaseStark=true\n\n# If your project needs to use multidex.\n# You'd better get rid of the `multiDexEnabled = true` in build.gradle and enable it here.\nmultiDexEnabled=false\n```\n\n\u003e stark-rules.txt\n\n```text\n# Add project specific stark rules here.\n# include packages that need  to be fixed in the future.\n# exclude packages that never to be fixed in the future.\n\n-include: applicationId.\n\n-exclude: android.support.\n```\n\n## Contributing\n\nFor more information about contributing, see our [contributing guide](CONTRIBUTING.md).\n\n## More\n\n* Read the [Chinese wiki](https://github.com/ximsfei/Stark/wiki)\n\n## Thinks\n\nThanks to InstantRun, Tinker, Small, jbsdiff and Robust.\n\n## About Author\n\nPengfeng Wang(王鹏锋)\n\nemail: ximsfei@gmail.com\n\n## [License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fximsfei%2Fstark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fximsfei%2Fstark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fximsfei%2Fstark/lists"}