[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4014":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},4014,"ARouter","alibaba\u002FARouter","alibaba","💪 A framework for assisting in the renovation of Android componentization (帮助 Android App 进行组件化改造的路由框架)","",null,"Java",14477,2606,365,130,0,3,4,45,"Apache License 2.0",false,"develop",true,[25,26,27,28,29,30],"android","componentization","dependency-injection","interceptor","navigation","router","2026-06-12 02:00:57","```\n    A framework for assisting in the renovation of Android app componentization\n```\n\n[中文文档](https:\u002F\u002Fgithub.com\u002Falibaba\u002FARouter\u002Fblob\u002Fmaster\u002FREADME_CN.md)\n\n##### [![Join the chat at https:\u002F\u002Fgitter.im\u002Falibaba\u002FARouter](https:\u002F\u002Fbadges.gitter.im\u002Falibaba\u002FARouter.svg)](https:\u002F\u002Fgitter.im\u002Falibaba\u002FARouter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Hex.pm](https:\u002F\u002Fimg.shields.io\u002Fhexpm\u002Fl\u002Fplug.svg)](https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0)\n\n---\n\n#### Lastest version\n\nmodule|arouter-api|arouter-compiler|arouter-register|arouter-idea-plugin\n---|---|---|---|---\nversion|[![Download](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-api\u002Fbadge.svg)](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-api)|[![Download](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-compiler\u002Fbadge.svg)](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-compiler)|[![Download](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-register\u002Fbadge.svg)](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.alibaba\u002Farouter-register)|[![as plugin](https:\u002F\u002Fimg.shields.io\u002Fjetbrains\u002Fplugin\u002Fd\u002F11428-arouter-helper.svg)](https:\u002F\u002Fplugins.jetbrains.com\u002Fplugin\u002F11428-arouter-helper)\n\n#### Demo\n\n##### [Demo apk](https:\u002F\u002Fgithub.com\u002Falibaba\u002FARouter\u002Fblob\u002Fdevelop\u002Fdemo\u002Farouter-demo-1.5.2.apk)、[Demo Gif](https:\u002F\u002Fraw.githubusercontent.com\u002Falibaba\u002FARouter\u002Fmaster\u002Fdemo\u002Farouter-demo.gif)\n\n#### I. Feature\n1. **Supports direct parsing of standard URLs for jumps and automatic injection of parameters into target pages**\n2. **Support for multi-module**\n3. **Support for interceptor**\n4. **Support for dependency injection**\n5. **InstantRun support**\n6. **MultiDex support**\n7. Mappings are grouped by group, multi-level management, on-demand initialization\n8. Supports users to specify global demotion and local demotion strategies\n9. Activity, interceptor and service can be automatically registered to the framework\n10. Support multiple ways to configure transition animation\n11. Support for fragment\n12. Full kotlin support (Look at Other#2)\n13. **Generate route doc support**\n14. **Provide IDE plugin for quick navigation to target class**\n15. Support Incremental annotation processing\n16. Support register route meta dynamic.\n\n#### II. Classic Case\n1. Forward from external URLs to internal pages, and parsing parameters\n2. Jump and decoupling between multi-module\n3. Intercept jump process, handle login, statistics and other logic\n4. Cross-module communication, decouple components by IoC\n\n#### III. Configuration\n1. Adding dependencies and configurations\n    ``` gradle\n    android {\n        defaultConfig {\n            ...\n            javaCompileOptions {\n                annotationProcessorOptions {\n                    arguments = [AROUTER_MODULE_NAME: project.getName()]\n                }\n            }\n        }\n    }\n\n    dependencies {\n        \u002F\u002F Replace with the latest version\n        compile 'com.alibaba:arouter-api:?'\n        annotationProcessor 'com.alibaba:arouter-compiler:?'\n        ...\n    }\n    \u002F\u002F Old version of gradle plugin (\u003C 2.2), You can use apt plugin, look at 'Other#1'\n    \u002F\u002F Kotlin configuration reference 'Other#2'\n    ```\n\n2. Add annotations\n    ``` java\n    \u002F\u002F Add annotations on pages that support routing (required)\n    \u002F\u002F The path here needs to pay attention to need at least two levels : \u002Fxx\u002Fxx\n    @Route(path = \"\u002Ftest\u002Factivity\")\n    public class YourActivity extend Activity {\n        ...\n    }\n    ```\n\n3. Initialize the SDK\n    ``` java\n    if (isDebug()) {           \u002F\u002F These two lines must be written before init, otherwise these configurations will be invalid in the init process\n        ARouter.openLog();     \u002F\u002F Print log\n        ARouter.openDebug();   \u002F\u002F Turn on debugging mode (If you are running in InstantRun mode, you must turn on debug mode! Online version needs to be closed, otherwise there is a security risk)\n    }\n    ARouter.init(mApplication); \u002F\u002F As early as possible, it is recommended to initialize in the Application\n    ```\n\n4. Initiate the routing\n    ``` java\n    \u002F\u002F 1. Simple jump within application (Jump via URL in 'Advanced usage')\n    ARouter.getInstance().build(\"\u002Ftest\u002Factivity\").navigation();\n\n    \u002F\u002F 2. Jump with parameters\n    ARouter.getInstance().build(\"\u002Ftest\u002F1\")\n                .withLong(\"key1\", 666L)\n                .withString(\"key3\", \"888\")\n                .withObject(\"key4\", new Test(\"Jack\", \"Rose\"))\n                .navigation();\n    ```\n\n5. Add confusing rules (If Proguard is turn on)\n    ``` \n    -keep public class com.alibaba.android.arouter.routes.**{*;}\n    -keep public class com.alibaba.android.arouter.facade.**{*;}\n    -keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}\n\n    # If you use the byType method to obtain Service, add the following rules to protect the interface:\n    -keep interface * implements com.alibaba.android.arouter.facade.template.IProvider\n\n    # If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation\n    # -keep class * implements com.alibaba.android.arouter.facade.template.IProvider\n    ```\n\n6. Using the custom gradle plugin to autoload the routing table\n    ```gradle\n    apply plugin: 'com.alibaba.arouter'\n\n    buildscript {\n        repositories {\n            mavenCentral()\n        }\n\n        dependencies {\n            \u002F\u002F Replace with the latest version\n            classpath \"com.alibaba:arouter-register:?\"\n        }\n    }\n    ```\n\n    Optional, use the registration plugin provided by the ARouter to automatically load the routing table(power by [AutoRegister](https:\u002F\u002Fgithub.com\u002Fluckybilly\u002FAutoRegister)). By default, the ARouter will scanned the dex files .\n    Performing an auto-registration via the gradle plugin can shorten the initialization time , it should be noted that the plugin must be used with api above 1.3.0!\n\n7. use ide plugin for quick navigation to target class (Optional)\n\n    Search for `ARouter Helper` in the Android Studio plugin market, or directly download the `arouter-idea-plugin` zip installation package listed in the `Latest version` above the documentation, after installation\n    plugin without any settings, U can find an icon at the beginning of the jump code. (![navigation](https:\u002F\u002Fraw.githubusercontent.com\u002Falibaba\u002FARouter\u002Fdevelop\u002Farouter-idea-plugin\u002Fsrc\u002Fmain\u002Fresources\u002Ficon\u002Foutline_my_location_black_18dp.png)) click the icon to jump to the target class that identifies the path in the code.\n\n#### IV. Advanced usage\n1. Jump via URL\n    ``` java\n    \u002F\u002F Create a new Activity for monitoring Scheme events, and then directly pass url to ARouter\n    public class SchemeFilterActivity extends Activity {\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n\n            Uri uri = getIntent().getData();\n            ARouter.getInstance().build(uri).navigation();\n            finish();\n        }\n    }\n    ```\n\n    AndroidManifest.xml\n    ``` xml\n    \u003Cactivity android:name=\".activity.SchemeFilterActivity\">\n        \u003C!-- Scheme -->\n        \u003Cintent-filter>\n            \u003Cdata\n                android:host=\"m.aliyun.com\"\n                android:scheme=\"arouter\"\u002F>\n\n            \u003Caction android:name=\"android.intent.action.VIEW\"\u002F>\n\n            \u003Ccategory android:name=\"android.intent.category.DEFAULT\"\u002F>\n            \u003Ccategory android:name=\"android.intent.category.BROWSABLE\"\u002F>\n        \u003C\u002Fintent-filter>\n    \u003C\u002Factivity>\n    ```\n\n2. Parse the parameters in the URL\n    ``` java\n    \u002F\u002F Declare a field for each parameter and annotate it with @Autowired\n    @Route(path = \"\u002Ftest\u002Factivity\")\n    public class Test1Activity extends Activity {\n        @Autowired\n        public String name;\n        @Autowired\n        int age;\n        @Autowired(name = \"girl\") \u002F\u002F Map different parameters in the URL by name\n        boolean boy;\n        @Autowired\n        TestObj obj;    \u002F\u002F Support for parsing custom objects, using json pass in URL\n\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n            ARouter.getInstance().inject(this);\n\n            \u002F\u002F ARouter will automatically set value of fields\n            Log.d(\"param\", name + age + boy);\n        }\n    }\n\n    \u002F\u002F If you need to pass a custom object, Create a new class(Not the custom object class),implement the SerializationService, And use the @Route annotation annotation, E.g:\n    @Route(path = \"\u002Fyourservicegroupname\u002Fjson\")\n    public class JsonServiceImpl implements SerializationService {\n        @Override\n        public void init(Context context) {\n\n        }\n\n        @Override\n        public \u003CT> T json2Object(String text, Class\u003CT> clazz) {\n            return JSON.parseObject(text, clazz);\n        }\n\n        @Override\n        public String object2Json(Object instance) {\n            return JSON.toJSONString(instance);\n        }\n    }\n    ```\n\n3. Declaration Interceptor (Intercept jump process, AOP)\n    ``` java\n    \u002F\u002F A more classic application is to handle login events during a jump so that there is no need to repeat the login check on the target page.\n    \u002F\u002F Interceptors will be executed between jumps, multiple interceptors will be executed in order of priority\n    @Interceptor(priority = 8, name = \"test interceptor\")\n    public class TestInterceptor implements IInterceptor {\n        @Override\n        public void process(Postcard postcard, InterceptorCallback callback) {\n            ...\n            \u002F\u002F No problem! hand over control to the framework\n            callback.onContinue(postcard);  \n            \n            \u002F\u002F Interrupt routing process\n            \u002F\u002F callback.onInterrupt(new RuntimeException(\"Something exception\"));      \n\n            \u002F\u002F The above two types need to call at least one of them, otherwise it will not continue routing\n        }\n\n        @Override\n        public void init(Context context) {\n            \u002F\u002F Interceptor initialization, this method will be called when sdk is initialized, it will only be called once\n        }\n    }\n    ```\n\n4. Processing jump results\n    ``` java\n    \u002F\u002F U can get the result of a single jump\n    ARouter.getInstance().build(\"\u002Ftest\u002F1\").navigation(this, new NavigationCallback() {\n        @Override\n        public void onFound(Postcard postcard) {\n        ...\n        }\n\n        @Override\n        public void onLost(Postcard postcard) {\n        ...\n        }\n    });\n    ```\n\n5. Custom global demotion strategy\n    ``` java\n    \u002F\u002F Implement the DegradeService interface\n    @Route(path = \"\u002Fxxx\u002Fxxx\")\n    public class DegradeServiceImpl implements DegradeService {\n        @Override\n        public void onLost(Context context, Postcard postcard) {\n            \u002F\u002F do something.\n        }\n\n        @Override\n        public void init(Context context) {\n\n        }\n    }\n    ```\n\n6. Decoupled by dependency injection : Service management -- Exposure services\n    ``` java\n    \u002F\u002F Declaration interface, other components get the service instance through the interface\n    public interface HelloService extends IProvider {\n        String sayHello(String name);\n    }\n\n    @Route(path = \"\u002Fyourservicegroupname\u002Fhello\", name = \"test service\")\n    public class HelloServiceImpl implements HelloService {\n\n        @Override\n        public String sayHello(String name) {\n            return \"hello, \" + name;\n        }\n\n        @Override\n        public void init(Context context) {\n\n        }\n    }\n    ```\n\n7. Decoupled by dependency injection : Service management -- Discovery service\n    ``` java\n    public class Test {\n        @Autowired\n        HelloService helloService;\n\n        @Autowired(name = \"\u002Fyourservicegroupname\u002Fhello\")\n        HelloService helloService2;\n\n        HelloService helloService3;\n\n        HelloService helloService4;\n\n        public Test() {\n            ARouter.getInstance().inject(this);\n        }\n\n        public void testService() {\n            \u002F\u002F 1. Use Dependency Injection to discover services, annotate fields with annotations\n            helloService.sayHello(\"Vergil\");\n            helloService2.sayHello(\"Vergil\");\n\n            \u002F\u002F 2. Discovering services using dependency lookup, the following two methods are byName and byType\n            helloService3 = ARouter.getInstance().navigation(HelloService.class);\n            helloService4 = (HelloService) ARouter.getInstance().build(\"\u002Fyourservicegroupname\u002Fhello\").navigation();\n            helloService3.sayHello(\"Vergil\");\n            helloService4.sayHello(\"Vergil\");\n        }\n    }\n    ```\n  \n8. Pretreatment Service\n    ``` java\n    @Route(path = \"\u002Fxxx\u002Fxxx\")\n    public class PretreatmentServiceImpl implements PretreatmentService {\n        @Override\n        public boolean onPretreatment(Context context, Postcard postcard) {\n            \u002F\u002F Do something before the navigation, if you need to handle the navigation yourself, the method returns false\n        }\n\n        @Override\n        public void init(Context context) {\n    \n        }\n    }\n    ```\n\n9. Dynamic register route meta\nApplicable to apps with plug-in architectures or some scenarios where routing information\nneeds to be dynamically registered，Dynamic registration can be achieved through the\ninterface provided by ARouter, The target page and service need not be marked with @Route\nannotation，**Only the routing information of the same group can be registered in the same batch**\n    ``` java\n        ARouter.getInstance().addRouteGroup(new IRouteGroup() {\n            @Override\n            public void loadInto(Map\u003CString, RouteMeta> atlas) {\n                atlas.put(\"\u002Fdynamic\u002Factivity\",      \u002F\u002F path\n                    RouteMeta.build(\n                        RouteType.ACTIVITY,         \u002F\u002F Route type\n                        TestDynamicActivity.class,  \u002F\u002F Target class\n                        \"\u002Fdynamic\u002Factivity\",        \u002F\u002F Path\n                        \"dynamic\",                  \u002F\u002F Group\n                        0,                          \u002F\u002F not need\n                        0                           \u002F\u002F Extra tag, Used to mark page feature\n                    )\n                );\n            }\n        });\n    ```\n\n#### V. More features\n\n1. Other settings in initialization\n    ``` java\n    ARouter.openLog(); \u002F\u002F Open log\n    ARouter.openDebug(); \u002F\u002F When using InstantRun, you need to open this switch and turn it off after going online. Otherwise, there is a security risk.\n    ARouter.printStackTrace(); \u002F\u002F Print thread stack when printing logs\n    ```\n\n2. API description\n    ``` java\n    \u002F\u002F Build a standard route request\n    ARouter.getInstance().build(\"\u002Fhome\u002Fmain\").navigation();\n\n    \u002F\u002F Build a standard route request, via URI\n    Uri uri;\n    ARouter.getInstance().build(uri).navigation();\n\n    \u002F\u002F Build a standard route request, startActivityForResult\n    \u002F\u002F The first parameter must be Activity and the second parameter is RequestCode\n    ARouter.getInstance().build(\"\u002Fhome\u002Fmain\", \"ap\").navigation(this, 5);\n\n    \u002F\u002F Pass Bundle directly\n    Bundle params = new Bundle();\n    ARouter.getInstance()\n        .build(\"\u002Fhome\u002Fmain\")\n        .with(params)\n        .navigation();\n\n    \u002F\u002F Set Flag\n    ARouter.getInstance()\n        .build(\"\u002Fhome\u002Fmain\")\n        .withFlags();\n        .navigation();\n\n    \u002F\u002F For fragment\n    Fragment fragment = (Fragment) ARouter.getInstance().build(\"\u002Ftest\u002Ffragment\").navigation();\n                        \n    \u002F\u002F transfer the object \n    ARouter.getInstance()\n        .withObject(\"key\", new TestObj(\"Jack\", \"Rose\"))\n        .navigation();\n\n    \u002F\u002F Think the interface is not enough, you can directly set parameter into Bundle\n    ARouter.getInstance()\n            .build(\"\u002Fhome\u002Fmain\")\n            .getExtra();\n\n    \u002F\u002F Transition animation (regular mode)\n    ARouter.getInstance()\n        .build(\"\u002Ftest\u002Factivity2\")\n        .withTransition(R.anim.slide_in_bottom, R.anim.slide_out_bottom)\n        .navigation(this);\n\n    \u002F\u002F Transition animation (API16+)\n    ActivityOptionsCompat compat = ActivityOptionsCompat.\n        makeScaleUpAnimation(v, v.getWidth() \u002F 2, v.getHeight() \u002F 2, 0, 0);\n\n    \u002F\u002F ps. makeSceneTransitionAnimation, When using shared elements, you need to pass in the current Activity in the navigation method\n\n    ARouter.getInstance()\n        .build(\"\u002Ftest\u002Factivity2\")\n        .withOptionsCompat(compat)\n        .navigation();\n            \n    \u002F\u002F Use green channel (skip all interceptors)\n    ARouter.getInstance().build(\"\u002Fhome\u002Fmain\").greenChannel().navigation();\n\n    \u002F\u002F Use your own log tool to print logs\n    ARouter.setLogger();\n\n    \u002F\u002F Use your custom thread pool\n    ARouter.setExecutor();\n    ```\n\n3. Get the original URI\n    ``` java\n    String uriStr = getIntent().getStringExtra(ARouter.RAW_URI);\n    ```\n\n4. Rewrite URL\n    ``` java\n    \u002F\u002F Implement the PathReplaceService interface\n    @Route(path = \"\u002Fxxx\u002Fxxx\")\n    public class PathReplaceServiceImpl implements PathReplaceService {\n        \u002F**\n        * For normal path.\n        *\n        * @param path raw path\n        *\u002F\n        String forString(String path) {\n            \u002F\u002F Custom logic\n            return path;\n        }\n\n    \u002F**\n        * For uri type.\n        *\n        * @param uri raw uri\n        *\u002F\n        Uri forUri(Uri uri) {\n            \u002F\u002F Custom logic\n            return url;\n        }\n    }\n    ```\n\n5. Generate router doc\n    ``` gradle\n    \u002F\u002F Edit build.gradle, add option 'AROUTER_GENERATE_DOC = enable'\n    \u002F\u002F Doc file : build\u002Fgenerated\u002Fsource\u002Fapt\u002F(debug or release)\u002Fcom\u002Falibaba\u002Fandroid\u002Farouter\u002Fdocs\u002Farouter-map-of-${moduleName}.json\n    android {\n        defaultConfig {\n            ...\n            javaCompileOptions {\n                annotationProcessorOptions {\n                    arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: \"enable\"]\n                }\n            }\n        }\n    }\n    ```\n\n#### VI. Other\n\n1. Old version of gradle plugin configuration\n    ``` gradle\n    apply plugin: 'com.neenbedankt.android-apt'\n\n    buildscript {\n        repositories {\n            mavenCentral()\n        }\n\n        dependencies {\n            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'\n        }\n    }\n\n    apt {\n        arguments {\n            AROUTER_MODULE_NAME project.getName();\n        }\n    }\n\n    dependencies {\n        compile 'com.alibaba:arouter-api:x.x.x'\n        apt 'com.alibaba:arouter-compiler:x.x.x'\n        ...\n    }\n    ```\n\n2. Kotlin project configuration\n    ```\n    \u002F\u002F You can refer to the wording in the \"module-kotlin\" module\n    apply plugin: 'kotlin-kapt'\n\n    kapt {\n        arguments {\n            arg(\"AROUTER_MODULE_NAME\", project.getName())\n        }\n    }\n\n    dependencies {\n        compile 'com.alibaba:arouter-api:x.x.x'\n        kapt 'com.alibaba:arouter-compiler:x.x.x'\n        ...\n    }\n    ```\n\n#### VII. Communication\n\n1. Communication\n\n    1. DingDing group1\n    \n        ![dingding](https:\u002F\u002Fraw.githubusercontent.com\u002Falibaba\u002FARouter\u002Fmaster\u002Fdemo\u002Fdingding-group-1.png)\n\n    2. QQ group1\n    \n        ![qq](https:\u002F\u002Fraw.githubusercontent.com\u002Falibaba\u002FARouter\u002Fmaster\u002Fdemo\u002Fqq-group-1.png)\n\n    3. QQ group2\n        \n        ![qq](https:\u002F\u002Fraw.githubusercontent.com\u002Falibaba\u002FARouter\u002Fmaster\u002Fdemo\u002Fqq-group-2.png)\n","ARouter 是一个帮助 Android 应用进行组件化改造的路由框架。它支持标准 URL 的直接解析和参数自动注入、多模块开发、拦截器以及依赖注入等核心功能，同时兼容 InstantRun 和 MultiDex，并且能够生成路由文档和支持 IDE 插件以实现快速导航到目标类。此外，ARouter 还允许用户自定义全局与局部降级策略，并提供了多种方式配置转场动画。该框架适用于需要提高应用内页面跳转灵活性、跨模块通信效率以及维护性的场景，特别适合大型项目的组件化开发。",2,"2026-06-11 02:57:56","top_language"]