{"id":13507571,"url":"https://github.com/alibaba/dexposed","last_synced_at":"2025-05-14T23:00:17.487Z","repository":{"id":41259763,"uuid":"38284404","full_name":"alibaba/dexposed","owner":"alibaba","description":"dexposed enable 'god' mode for single android application.","archived":false,"fork":false,"pushed_at":"2017-03-29T11:48:10.000Z","size":1875,"stargazers_count":4522,"open_issues_count":19,"forks_count":1069,"subscribers_count":388,"default_branch":"master","last_synced_at":"2025-04-13T19:41:21.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-30T02:59:16.000Z","updated_at":"2025-04-11T07:10:29.000Z","dependencies_parsed_at":"2022-08-02T19:46:05.615Z","dependency_job_id":null,"html_url":"https://github.com/alibaba/dexposed","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fdexposed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fdexposed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fdexposed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fdexposed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibaba","download_url":"https://codeload.github.com/alibaba/dexposed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243353,"owners_count":22038044,"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":[],"created_at":"2024-08-01T02:00:36.357Z","updated_at":"2025-05-14T23:00:17.439Z","avatar_url":"https://github.com/alibaba.png","language":"Java","readme":"What is it?\r\n-----------\r\n\r\n[![Download](https://api.bintray.com/packages/hwjump/maven/dexposed/images/download.svg) ](https://bintray.com/hwjump/maven/dexposed/_latestVersion)\r\n[![Software License](https://rawgit.com/alibaba/dexposed/master/images/license.svg)](LICENSE)\r\n[![Join the chat at https://gitter.im/alibaba/dexposed](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/alibaba/dexposed?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)   \r\n\r\nDexposed is a powerful yet non-invasive runtime [AOP (Aspect-oriented Programming)](http://en.wikipedia.org/wiki/Aspect-oriented_programming) framework\r\nfor Android app development, based on the work of open-source [Xposed](https://github.com/rovo89/Xposed) [framework](https://github.com/rovo89/XposedBridge) project.\r\n\r\nThe AOP of Dexposed is implemented purely non-invasive, without any annotation processor,\r\nweaver or bytecode rewriter. The integration is as simple as loading a small JNI library\r\nin just one line of code at the initialization phase of your app.\r\n\r\nNot only the code of your app, but also the code of Android framework that running in your\r\napp process can be hooked. This feature is extremely useful in Android development as we\r\ndevelopers heavily rely on the fragmented old versions of Android platform (SDK).\r\n\r\nTogether with dynamic class loading, a small piece of compiled Java AOP code can be loaded\r\ninto the running app, effectively altering the behavior of the target app without restart.\r\n\r\nTypical use-cases\r\n-----------------\r\n* Classic AOP programming\r\n* Instrumentation (for testing, performance monitoring and etc.)\r\n* Online hot patch to fix critical, emergent or security bugs\r\n* SDK hooking for a better development experience\r\n\r\nIntegration\r\n-----------\r\nDirectly add dexposed aar to your project as compile libraries, it contains a jar file \"dexposedbridge.jar\" two so files \"libdexposed.so libdexposed_l.so\" from 'dexposed' directory.\r\n\r\nGradle dependency like following:\r\n\r\n```groovy\r\n\tdependencies {\r\n\t    compile 'com.taobao.android:dexposed:0.1.1@aar'\r\n\t}\r\n```\r\n\r\nInsert the following line into the initialization phase of your app, as early as possible:\r\n\r\n```java\r\n    public class MyApplication extends Application {\r\n\r\n        @Override public void onCreate() {        \r\n            // Check whether current device is supported (also initialize Dexposed framework if not yet)\r\n            if (DexposedBridge.canDexposed(this)) {\r\n                // Use Dexposed to kick off AOP stuffs.\r\n                ...\r\n            }\r\n        }\r\n        ...\r\n    }\r\n```\r\n\r\nIt's done.\r\n\r\nBasic usage\r\n-----------\r\n\r\nThere are three injection points for a given method: *before*, *after*, *replace*.\r\n\r\nExample 1: Attach a piece of code before and after all occurrences of `Activity.onCreate(Bundle)`.\r\n\r\n```java\r\n        // Target class, method with parameter types, followed by the hook callback (XC_MethodHook).\r\n\t\tDexposedBridge.findAndHookMethod(Activity.class, \"onCreate\", Bundle.class, new XC_MethodHook() {\r\n        \r\n            // To be invoked before Activity.onCreate().\r\n\t\t\t@Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\r\n\t\t\t\t// \"thisObject\" keeps the reference to the instance of target class.\r\n\t\t\t\tActivity instance = (Activity) param.thisObject;\r\n        \r\n\t\t\t\t// The array args include all the parameters.\r\n\t\t\t\tBundle bundle = (Bundle) param.args[0];\r\n\t\t\t\tIntent intent = new Intent();\r\n\t\t\t\t// XposedHelpers provide useful utility methods.\r\n\t\t\t\tXposedHelpers.setObjectField(param.thisObject, \"mIntent\", intent);\r\n\t\t\r\n\t\t\t\t// Calling setResult() will bypass the original method body use the result as method return value directly.\r\n\t\t\t\tif (bundle.containsKey(\"return\"))\r\n\t\t\t\t\tparam.setResult(null);\r\n\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t// To be invoked after Activity.onCreate()\r\n\t\t\t@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {\r\n\t\t        XposedHelpers.callMethod(param.thisObject, \"sampleMethod\", 2);\r\n\t\t\t}\r\n\t\t});\r\n```\r\n\r\nExample 2: Replace the original body of the target method.\r\n\r\n```java\r\n\t\tDexposedBridge.findAndHookMethod(Activity.class, \"onCreate\", Bundle.class, new XC_MethodReplacement() {\r\n\t\t\r\n\t\t\t@Override protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {\r\n\t\t\t\t// Re-writing the method logic outside the original method context is a bit tricky but still viable.\r\n\t\t\t\t...\r\n\t\t\t}\r\n\r\n\t\t});\r\n```\r\n\r\nCheckout the `example` project to find out more.\r\n\r\nSupport\r\n----------\r\nDexposed support all dalvik runtime arm architecture devices from Android 2.3 to 4.4 (no include 3.0). The stability has been proved in our long term product practice.\r\n\r\nFollow is support status.\r\n\r\nRuntime | Android Version | Support\r\n------  | --------------- | --------\r\nDalvik  | 2.2             | Not Test\r\nDalvik  | 2.3             | Yes\r\nDalvik  | 3.0             | No\r\nDalvik  | 4.0-4.4         | Yes\r\nART     | 5.0             | Testing\r\nART     | 5.1             | No\r\nART     | M               | No\r\n \r\n\r\nContribute\r\n----------\r\nWe are open to constructive contributions from the community, especially pull request\r\nand quality bug report. **Currently, the support for new Android Runtime (ART) is still\r\nin early beta stage, we value your help to test or improve the implementation.**\r\n\r\nDexposed is aimed to be lightweight, transparent and productive. All improvements with\r\nthese principal in mind are welcome. At the same time, we are actively exploring more\r\npotentially valuable use-cases and building powerful tools based upon Dexposed. We're\r\ninterested in any ideas expanding the use-cases and grateful for community developed\r\ntools on top of Dexposed.\r\n","funding_links":[],"categories":["CN","Java","Index","Mobile Development","Libs","Other"],"sub_categories":["[Alibaba](https://github.com/alibaba)","Android Hot Fix","C++/C Toolkit","\u003cA NAME=\"Framework\"\u003e\u003c/A\u003eFramework"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fdexposed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibaba%2Fdexposed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fdexposed/lists"}