{"action":"created","issue":{"url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/133","repository_url":"https://api.github.com/repos/yanzhenjie/AndServer","labels_url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/133/comments","events_url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/133/events","html_url":"https://github.com/yanzhenjie/AndServer/issues/133","id":389733276,"node_id":"MDU6SXNzdWUzODk3MzMyNzY=","number":133,"title":"2.0版本在xposed模块中ComponentRegister的问题","user":{"login":"f111fei","id":7069719,"node_id":"MDQ6VXNlcjcwNjk3MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/7069719?v=4","gravatar_id":"","url":"https://api.github.com/users/f111fei","html_url":"https://github.com/f111fei","followers_url":"https://api.github.com/users/f111fei/followers","following_url":"https://api.github.com/users/f111fei/following{/other_user}","gists_url":"https://api.github.com/users/f111fei/gists{/gist_id}","starred_url":"https://api.github.com/users/f111fei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f111fei/subscriptions","organizations_url":"https://api.github.com/users/f111fei/orgs","repos_url":"https://api.github.com/users/f111fei/repos","events_url":"https://api.github.com/users/f111fei/events{/privacy}","received_events_url":"https://api.github.com/users/f111fei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-11T12:06:15Z","updated_at":"2018-12-11T12:16:02Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"andserver的代码是在Xposed模块中的和被hook的app不在一个dex里面，andserver实际上是被注入到了被hook的app中，初始化是使用了被hook的app的context初始化的，这样在ComponentRegister运行的时候，被hook的app的dexFile里面是没有AdapterRegister这个类存在的，导致初始化失败。\r\n\r\n简单理解成，andserver是作为一个dex动态加载到app中的，但是getDexFilePaths这个方法只获取了app的dex文件中的类，造成注册失败。\r\n\r\n所以这种情况下，andserver是不是要提供一个手动注册的接口，动态注册？"},"comment":{"url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/comments/446182171","html_url":"https://github.com/yanzhenjie/AndServer/issues/133#issuecomment-446182171","issue_url":"https://api.github.com/repos/yanzhenjie/AndServer/issues/133","id":446182171,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjE4MjE3MQ==","user":{"login":"f111fei","id":7069719,"node_id":"MDQ6VXNlcjcwNjk3MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/7069719?v=4","gravatar_id":"","url":"https://api.github.com/users/f111fei","html_url":"https://github.com/f111fei","followers_url":"https://api.github.com/users/f111fei/followers","following_url":"https://api.github.com/users/f111fei/following{/other_user}","gists_url":"https://api.github.com/users/f111fei/gists{/gist_id}","starred_url":"https://api.github.com/users/f111fei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f111fei/subscriptions","organizations_url":"https://api.github.com/users/f111fei/orgs","repos_url":"https://api.github.com/users/f111fei/repos","events_url":"https://api.github.com/users/f111fei/events{/privacy}","received_events_url":"https://api.github.com/users/f111fei/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T12:16:02Z","updated_at":"2018-12-11T12:16:02Z","author_association":"CONTRIBUTOR","body":"目前在Xposed中，我的解决办法是直接hook ComponentRegister的 register方法，修改register的逻辑\r\n\r\n```\r\nXposedHelpers.findAndHookMethod(MainActivity, \"onCreate\", Bundle.class, new XC_MethodHook() {\r\n            @Override\r\n            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\r\n                super.beforeHookedMethod(param);\r\n            }\r\n\r\n            @Override\r\n            protected void afterHookedMethod(MethodHookParam param) throws Throwable {\r\n                super.afterHookedMethod(param);\r\n                Context context = AndroidAppHelper.currentApplication().getApplicationContext();\r\n                // 使用被hook app的context启动andserver\r\n                WebServer.startServer(context);\r\n            }\r\n        });\r\n\r\n\r\nXposedHelpers.findAndHookMethod(ComponentRegister.class, \"register\", Register.class, new XC_MethodHook() {\r\n    @Override\r\n    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\r\n        super.beforeHookedMethod(param);\r\n    }\r\n\r\n    @Override\r\n    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\r\n        super.afterHookedMethod(param);\r\n        Register register = (Register) param.args[0];\r\n        // hook register方法手动初始化\r\n        new AdapterRegister().onRegister(register);\r\n        new ResolverRegister().onRegister(register);\r\n    }\r\n});\r\n```"}}
{"actor":{"display_login":"f111fei"}}