{"id":6046,"date":"2023-10-04T16:32:07","date_gmt":"2023-10-04T08:32:07","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=6046"},"modified":"2023-10-04T16:32:07","modified_gmt":"2023-10-04T08:32:07","slug":"%e7%bd%91%e9%a1%b5%e5%b0%81%e8%a3%85%e6%88%90%e5%ae%89%e5%8d%93apk%e5%b7%a5%e5%85%b7%e6%93%8d%e4%bd%9c%e6%b5%81%e7%a8%8b%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/6046\/","title":{"rendered":"\u7f51\u9875\u5c01\u88c5\u6210\u5b89\u5353apk\u5de5\u5177\u64cd\u4f5c\u6d41\u7a0b\u4ecb\u7ecd"},"content":{"rendered":"

\u5c06\u7f51\u9875\u5c01\u88c5\u6210\u5b89\u5353apk\u5de5\u5177\u53ef\u4ee5\u4f7f\u7f51\u9875\u5728\u5b89\u5353\u8bbe\u5907\u4e0a\u4ee5\u539f\u751f\u5e94\u7528\u7684\u5f62\u5f0f\u8fd0\u884c\uff0c\u7ed9\u7528\u6237\u63d0\u4f9b\u66f4\u597d\u7684\u4ea4\u4e92\u4f53\u9a8c\u548c\u65b9\u4fbf\u7684\u8bbf\u95ee\u65b9\u5f0f\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5c01\u88c5\u7f51\u9875\u4e3a\u5b89\u5353apk\u7684\u539f\u7406\u548c\u8fc7\u7a0b\u3002<\/p>\n

1. \u539f\u7406\uff1a<\/p>\n

\u7f51\u9875\u5c01\u88c5\u6210\u5b89\u5353apk\u7684\u539f\u7406\u662f\u5c06\u7f51\u9875\u7684HTML\u3001CSS\u548cJavaScript\u6587\u4ef6\u6253\u5305\u5e76\u96c6\u6210\u5230\u4e00\u4e2a\u5b89\u5353\u5e94\u7528\u4e2d\uff0c\u901a\u8fc7WebView\u7ec4\u4ef6\u52a0\u8f7d\u5e76\u663e\u793a\u7f51\u9875\u5185\u5bb9\u3002WebView\u662f\u5b89\u5353\u63d0\u4f9b\u7684\u4e00\u4e2a\u7528\u4e8e\u663e\u793a\u7f51\u9875\u5185\u5bb9\u7684\u63a7\u4ef6\uff0c\u901a\u8fc7\u5728\u5b89\u5353\u5e94\u7528\u4e2d\u4f7f\u7528WebView\uff0c\u53ef\u4ee5\u5c06\u7f51\u9875\u5185\u5bb9\u76f4\u63a5\u663e\u793a\u5728\u5e94\u7528\u4e2d\u3002<\/p>\n

2. \u8fc7\u7a0b\uff1a<\/p>\n

\u5c01\u88c5\u7f51\u9875\u4e3a\u5b89\u5353apk\u7684\u8fc7\u7a0b\u5206\u4e3a\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n

\u6b65\u9aa4\u4e00\uff1a\u51c6\u5907\u5de5\u4f5c<\/p>\n

\u5728\u5f00\u59cb\u5c01\u88c5\u4e4b\u524d\uff0c\u9700\u8981\u51c6\u5907\u597d\u4ee5\u4e0b\u51e0\u4e2a\u6587\u4ef6\uff1a<\/p>\n

– \u7f51\u9875\u7684HTML\u6587\u4ef6\uff1a\u5305\u542b\u7f51\u9875\u7684\u7ed3\u6784\u548c\u5185\u5bb9\u3002<\/p>\n

– \u7f51\u9875\u7684CSS\u6587\u4ef6\uff1a\u7528\u4e8e\u5b9a\u4e49\u7f51\u9875\u7684\u6837\u5f0f\u3002<\/p>\n

– \u7f51\u9875\u7684JavaScript\u6587\u4ef6\uff1a\u7528\u4e8e\u5b9e\u73b0\u7f51\u9875\u7684\u4ea4\u4e92\u529f\u80fd\u3002<\/p>\n

\u6b65\u9aa4\u4e8c\uff1a\u521b\u5efa\u5b89\u5353\u9879\u76ee<\/p>\n

\u5728Android Studio\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b89\u5353\u9879\u76ee\u3002\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u7a7a\u767d\u6d3b\u52a8\u6216\u5176\u4ed6\u6a21\u677f\u3002<\/p>\n

\u6b65\u9aa4\u4e09\uff1a\u5bfc\u5165\u6587\u4ef6<\/p>\n

\u5c06\u7f51\u9875\u7684HTML\u3001CSS\u548cJavaScript\u6587\u4ef6\u5bfc\u5165\u5230\u5b89\u5353\u9879\u76ee\u4e2d\u7684\u6307\u5b9a\u4f4d\u7f6e\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u53ef\u4ee5\u5c06HTML\u6587\u4ef6\u653e\u7f6e\u5728assets\u6587\u4ef6\u5939\u4e2d\uff0cCSS\u548cJavaScript\u6587\u4ef6\u53ef\u4ee5\u653e\u7f6e\u5728assets\u6587\u4ef6\u5939\u4e2d\u7684\u5b50\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n

\u6b65\u9aa4\u56db\uff1a\u8c03\u6574\u5e03\u5c40\u548c\u6837\u5f0f<\/p>\n

\u6253\u5f00\u9879\u76ee\u4e2d\u7684\u5e03\u5c40\u6587\u4ef6\uff0c\u901a\u8fc7\u6dfb\u52a0WebView\u7ec4\u4ef6\u6765\u663e\u793a\u7f51\u9875\u5185\u5bb9\u3002\u53ef\u4ee5\u8bbe\u7f6eWebView\u7684\u5927\u5c0f\u3001\u4f4d\u7f6e\u548c\u5176\u4ed6\u5c5e\u6027\u3002<\/p>\n

\u6b65\u9aa4\u4e94\uff1a\u52a0\u8f7d\u7f51\u9875\u5185\u5bb9<\/p>\n

\u5728\u5b89\u5353\u9879\u76ee\u7684java\u6587\u4ef6<\/p>\n

<\/figure>\n<\/p>\n

\u4e2d\uff0c\u4f7f\u7528WebView\u7ec4\u4ef6\u52a0\u8f7d\u7f51\u9875\u7684HTML\u6587\u4ef6\u3002\u53ef\u4ee5\u901a\u8fc7WebView\u7684loadUrl()\u65b9\u6cd5\u6216\u8005loadDataWithBaseURL()\u65b9\u6cd5\u52a0\u8f7d\u7f51\u9875\u5185\u5bb9\u3002<\/p>\n

\u6b65\u9aa4\u516d\uff1a\u8fd0\u884c\u5e94\u7528<\/p>\n

\u5c06\u5b89\u5353\u8bbe\u5907\u8fde\u63a5\u5230\u5f00\u53d1\u7535\u8111\u4e0a\uff0c\u5728Android Studio\u4e2d\u70b9\u51fb\u8fd0\u884c\u6309\u94ae\uff0c\u5c06\u5e94\u7528\u5b89\u88c5\u5230\u8bbe\u5907\u4e0a\u5e76\u8fd0\u884c\u3002<\/p>\n

\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u5c31\u53ef\u4ee5\u5c06\u7f51\u9875\u5c01\u88c5\u4e3a\u5b89\u5353apk\uff0c\u5e76\u5728\u5b89\u5353\u8bbe\u5907\u4e0a\u4ee5\u5e94\u7528\u7684\u5f62\u5f0f\u8fd0\u884c\u3002<\/p>\n

\u5c01\u88c5\u7f51\u9875\u4e3a\u5b89\u5353apk\u7684\u5de5\u5177\uff1a<\/p>\n

\u9664\u4e86\u53ef\u4ee5\u624b\u52a8\u8fdb\u884c\u5b89\u5353\u7f51\u9875\u4e00\u952e\u5c01\u88c5app\u5de5\u5177\u5206\u4eab<\/a>\u7f51\u9875\u5c01\u88c5\u4e3a\u5b89\u5353apk\u7684\u6b65\u9aa4\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u4e13\u95e8\u7684\u5de5\u5177\u6765\u7b80\u5316\u8fd9\u4e2a\u8fc7\u7a0b\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u81ea\u52a8\u5316\u5730\u5b8c\u6210\u6587\u4ef6\u5bfc\u5165\u3001\u5e03\u5c40\u8c03\u6574\u548c\u4ee3\u7801\u7f16\u5199\u7b49\u64cd\u4f5c\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5c01\u88c5\u7684\u6548\u7387\u3002\u4f8b\u5982\uff0cApache Cordova\u548cReact Native\u7b49\u6846\u67b6\u90fd\u63d0\u4f9b\u4e86\u5c01\u88c5\u7f51\u9875\u4e3a\u5b89\u5353apk\u7684\u529f\u80fd\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528\u5b83\u4eec\u6765\u5feb\u901f\u642d\u5efa\u5b89\u5353\u5e94\u7528\u5e76\u52a0\u8f7d\u7f51\u9875\u5185\u5bb9\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u5c06\u7f51\u9875\u5c01\u88c5\u4e3a\u5b89\u5353apk\u662f\u4e00\u79cd\u5c06\u7f51\u9875\u5185\u5bb9\u4ee5\u539f\u751f\u5e94\u7528\u7684\u5f62\u5f0f\u8fd0\u884c\u5728\u5b89\u5353\u8bbe\u5907\u4e0a\u7684\u65b9\u6cd5\u3002\u901a\u8fc7\u5c06\u7f51\u9875\u7684HTML\u3001CSS\u548cJav\u5b89\u5353\u65e0\u9650post\u5de5\u5177\u5c01\u88c5<\/a>aScript\u6587\u4ef6\u6253\u5305\u5e76\u96c6\u6210\u5230\u5b89\u5353\u5e94\u7528\u4e2d\uff0c\u7136\u540e\u4f7f\u7528WebView\u7ec4\u4ef6\u52a0\u8f7d\u5e76\u663e\u793a\u7f51\u9875\u5185\u5bb9\uff0c\u53ef\u4ee5\u7ed9\u7528\u6237\u5e26\u6765\u66f4\u597d\u7684\u4ea4\u4e92\u4f53\u9a8c\u548c\u65b9\u4fbf\u7684\u8bbf\u95ee\u65b9\u5f0f\u3002\u53ef\u4ee5\u624b\u52a8\u8fdb\u884c\u5c01\u88c5\u7684\u6b65\u9aa4\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e13\u95e8\u7684\u5de5\u5177\u6765\u7b80\u5316\u5c01\u88c5\u7684\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5c06\u7f51\u9875\u5c01\u88c5\u6210\u5b89\u5353apk\u5de5\u5177\u53ef\u4ee5\u4f7f\u7f51\u9875\u5728\u5b89\u5353\u8bbe\u5907\u4e0a\u4ee5\u539f\u751f\u5e94\u7528\u7684\u5f62\u5f0f\u8fd0\u884c\uff0c\u7ed9\u7528\u6237\u63d0\u4f9b\u66f4\u597d\u7684\u4ea4\u4e92\u4f53\u9a8c\u548c\u65b9\u4fbf\u7684\u8bbf\u95ee\u65b9\u5f0f\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5c01\u88c5\u7f51\u9875\u4e3a\u5b89\u5353apk\u7684\u539f\u7406\u548c\u8fc7\u7a0b\u30021. \u539f\u7406\uff1a\u7f51\u9875\u5c01\u88c5\u6210\u5b89\u5353apk\u7684\u539f\u7406<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[5289,8658,16,797,149],"topic":[],"class_list":["post-6046","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-wapapp","tag-8658","tag-16","tag-797","tag-149"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/6046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=6046"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/6046\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=6046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=6046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=6046"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=6046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}