{"id":1600,"date":"2017-07-06T15:37:27","date_gmt":"2017-07-06T07:37:27","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1600"},"modified":"2018-10-07T17:14:02","modified_gmt":"2018-10-07T09:14:02","slug":"replugin%e4%b8%bb%e7%a8%8b%e5%ba%8f%e6%8e%a5%e5%85%a5%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1600","title":{"rendered":"RePlugin\u4e3b\u7a0b\u5e8f\u63a5\u5165\u6559\u7a0b"},"content":{"rendered":"<p>\n\t\u968f\u7740 360 \u7684 <a href=\"https:\/\/github.com\/Qihoo360\/RePlugin\/blob\/master\/README_CN.md\" name=\"RePlugin\" target=\"_blank\" title=\"RePlugin\">RePlugin<\/a>&nbsp;\u5168\u9762\u63d2\u4ef6\u5316\u65b9\u6848\u88ab\u63d0\u51fa\u3002\u6211\u76f8\u4fe1&nbsp;RePlugin \u4f1a\u8d8a\u6765\u8d8a\u6d41\u884c\u3002\u56e0\u6b64\u4fbf\u7f16\u5199\u4e86\u672c\u7bc7\u6559\u7a0b\u3002\n<\/p>\n<p>\n\t\u6839\u636e\u5b98\u65b9\u7684\u6587\u6863\u63d0\u793a\uff0c\u6211\u4eec\u53ea\u9700\u89813\u6b65\uff0c\u5373\u53ef\u5b9e\u73b0RePlugin\u4e3b\u7a0b\u5e8f\u63a5\u5165\u529f\u80fd\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"RePlugin \u67b6\u6784\u56fe\" src=\"http:\/\/www.xttblog.com\/wp-content\/uploads\/2018\/10\/bd_img.png\" style=\"width: 1024px;height: 768px\" \/>\n<\/p>\n<h2>\n\t\u6dfb\u52a0 RePlugin Host Gradle \u4f9d\u8d56<br \/>\n<\/h2>\n<p>\n\t\u5728\u9879\u76ee\u6839\u76ee\u5f55\u7684 build.gradle\uff08\u6ce8\u610f\uff1a\u4e0d\u662f app\/build.gradle\uff09 \u4e2d\u6dfb\u52a0 replugin-host-gradle \u4f9d\u8d56\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nbuildscript {\r\n    dependencies {\r\n        classpath &#039;com.qihoo360.replugin:replugin-host-gradle:2.1.0&#039;\r\n        ...\r\n    }\r\n}<\/pre>\n<h2>\n\t\u6dfb\u52a0 RePlugin Host Library \u4f9d\u8d56<br \/>\n<\/h2>\n<p>\n\t\u5728 app\/build.gradle \u4e2d\u5e94\u7528 replugin-host-gradle \u63d2\u4ef6\uff0c\u5e76\u6dfb\u52a0 replugin-host-lib \u4f9d\u8d56\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\napply plugin: &#039;replugin-host-gradle&#039;\r\n\r\ndependencies {\r\n    compile &#039;com.qihoo360.replugin:replugin-host-lib:2.1.0&#039;\r\n    ...\r\n}<\/pre>\n<h2>\n\t\u914d\u7f6e Application \u7c7b<br \/>\n<\/h2>\n<p>\n\t\u8ba9\u5de5\u7a0b\u7684 Application \u76f4\u63a5\u7ee7\u627f\u81ea RePluginApplication\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u60a8\u7684\u5de5\u7a0b\u5df2\u6709Application\u7c7b\uff0c\u5219\u53ef\u4ee5\u5c06\u57fa\u7c7b\u5207\u6362\u5230RePluginApplication\u5373\u53ef\u3002\u6216\u8005\u60a8\u4e5f\u53ef\u4ee5\u7528&ldquo;\u975e\u7ee7\u627f\u5f0f&rdquo;\u63a5\u5165\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\npublic class MainApplication extends RePluginApplication {}<\/pre>\n<p>\n\t\u65e2\u7136\u58f0\u660e\u4e86Application\uff0c\u81ea\u7136\u8fd8\u9700\u8981\u5728AndroidManifest\u4e2d\u914d\u7f6e\u8fd9\u4e2aApplication\u3002\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;application android:name=&quot;.MainApplication&quot; ... \/&gt;<\/pre>\n<p>\n\t\u5907\u9009\uff1a&ldquo;\u975e\u7ee7\u627f\u5f0f&rdquo;\u914d\u7f6eApplication\n<\/p>\n<p>\n\t\u82e5\u60a8\u7684\u5e94\u7528\u5bf9Application\u7c7b\u7ee7\u627f\u5173\u7cfb\u7684\u4fee\u6539\u6709\u9650\u5236\uff0c\u6216\u60f3\u81ea\u5b9a\u4e49RePlugin\u52a0\u8f7d\u8fc7\u7a0b\uff08\u614e\u7528\uff01\uff09\uff0c\u5219\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u76f8\u5173\u65b9\u6cd5\u6765\u4f7f\u7528RePlugin\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\npublic class MainApplication extends Application {\r\n\r\n    @Override\r\n    protected void attachBaseContext(Context base) {\r\n        super.attachBaseContext(base);\r\n\r\n        RePlugin.App.attachBaseContext(this);\r\n        ....\r\n    }\r\n\r\n    @Override\r\n    public void onCreate() {\r\n        super.onCreate();\r\n\r\n        RePlugin.App.onCreate();\r\n        ....\r\n    }\r\n\r\n    @Override\r\n    public void onLowMemory() {\r\n        super.onLowMemory();\r\n\r\n        \/* Not need to be called if your application&#039;s minSdkVersion &gt; = 14 *\/\r\n        RePlugin.App.onLowMemory();\r\n        ....\r\n    }\r\n\r\n    @Override\r\n    public void onTrimMemory(int level) {\r\n        super.onTrimMemory(level);\r\n\r\n        \/* Not need to be called if your application&#039;s minSdkVersion &gt; = 14 *\/\r\n        RePlugin.App.onTrimMemory(level);\r\n        ....\r\n    }\r\n\r\n    @Override\r\n    public void onConfigurationChanged(Configuration config) {\r\n        super.onConfigurationChanged(config);\r\n\r\n        \/* Not need to be called if your application&#039;s minSdkVersion &gt; = 14 *\/\r\n        RePlugin.App.onConfigurationChanged(config);\r\n        ....\r\n    }\r\n}<\/pre>\n<p>\n\t\u9488\u5bf9&ldquo;\u975e\u7ee7\u627f\u5f0f&rdquo;\u7684\u6ce8\u610f\u70b9\n<\/p>\n<ul>\n<li>\n\t\t\u6240\u6709\u65b9\u6cd5\u5fc5\u987b\u5728UI\u7ebf\u7a0b\u6765&ldquo;\u540c\u6b65&rdquo;\u8c03\u7528\u3002\u5207\u52ff\u653e\u5230\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u6216\u8005\u901a\u8fc7post\u65b9\u6cd5\u6765\u6267\u884c\n\t<\/li>\n<li>\n\t\t\u6240\u6709\u65b9\u6cd5\u5fc5\u987b\u4e00\u4e00\u5bf9\u5e94\uff0c\u4f8b\u5982 RePlugin.App.attachBaseContext \u65b9\u6cd5\u53ea\u5728Application.attachBaseContext\u4e2d\u8c03\u7528\n\t<\/li>\n<li>\n\t\t\u8bf7\u5c06RePlugin.App\u7684\u8c03\u7528\u65b9\u6cd5\uff0c\u653e\u5728&ldquo;\u4ec5\u6b21\u4e8esuper.xxx()&rdquo;\u65b9\u6cd5\u7684\u540e\u9762\n\t<\/li>\n<\/ul>\n<h2>\n\t\u5b9e\u9645\u63a5\u5165\u8fc7\u7a0b\u4e2d\u78b0\u5230\u7684\u95ee\u9898<br \/>\n<\/h2>\n<p>\n\t\u4e0b\u8f7dRePlugin\u4f9d\u8d56\u5305\u51fa\u9519\uff1a\n<\/p>\n<p>\n\tD:\\jeff_workspace\\TestRePlugin\\app\\build.gradle<br \/>\n\tError:(33, 13) Failed to resolve: com.qihoo360.replugin:replugin-host-lib:2.1.0\n<\/p>\n<p>\n\t\u89e3\u51b3\u8fc7\u7a0b\uff1a\u67e5\u770b\u5b98\u65b9Sample\u6e90\u7801\u4e2d\u7684build.gradle\u53d1\u73b0\u95ee\u9898\u6240\u5728\uff0c\u9700\u8981\u5728project\u4e0b\u7684build.gradle\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\n\/\/buildscript repositories\u4ee5\u53caallprojects repositories\u4e2d\u6dfb\u52a0RePlugin Repository\r\nmaven {\r\n    url  &quot;https:\/\/dl.bintray.com\/qihoo360\/replugin&quot;\r\n}<\/pre>\n<p>\n\tGradle\u6784\u5efa\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\nExecution failed for task &#039;:app:processDebugResources&#039;.\r\n&gt; D:\\jeff_workspace\\TestRePlugin\\app\\src\\main\\assets\\plugins<\/pre>\n<p>\n\t\u89e3\u51b3\u8fc7\u7a0b\uff1a\u5728Github Issues\u4e2d\u53d1\u73b0#48\u4e5f\u63d0\u5230\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u89e3\u51b3\u529e\u6cd5\u5728\u91cc\u9762\u5df2\u7ecf\u7ed9\u51fa\uff1a\n<\/p>\n<p>\n\t\u5728 assets \u4e0b\u65b0\u5efa\u6587\u4ef6\u5939 plugins\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1600\">RePlugin\u4e3b\u7a0b\u5e8f\u63a5\u5165\u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740 360 \u7684 RePlugin&nbsp;\u5168\u9762\u63d2\u4ef6\u5316\u65b9\u6848\u88ab\u63d0\u51fa\u3002\u6211\u76f8\u4fe1&nbsp;RePlugin \u4f1a\u8d8a\u6765 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[891,1319,1336,1337,844],"class_list":["post-1600","post","type-post","status-publish","format-standard","hentry","category-java","tag-android","tag-replugin","tag-repluginapplication","tag-844"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1600"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1600\/revisions"}],"predecessor-version":[{"id":3164,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1600\/revisions\/3164"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}