{"id":16867,"date":"2024-02-29T10:43:12","date_gmt":"2024-02-29T02:43:12","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=16867"},"modified":"2024-02-29T10:43:12","modified_gmt":"2024-02-29T02:43:12","slug":"webview%e6%89%93%e5%8c%85exe%e6%9c%89%e5%95%a5%e6%96%b9%e6%b3%95%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/16867\/","title":{"rendered":"webview\u6253\u5305exe\u6709\u5565\u65b9\u6cd5\uff1f"},"content":{"rendered":"

WebView\u662fAndroid\u7cfb\u7edf\u63d0\u4f9b\u7684\u4e00\u4e2a\u63a7\u4ef6\uff0c\u53ef\u4ee5\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5d4c\u5165\u7f51\u9875\uff0c\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u5c55\u793a\u7f51\u9875\u5185\u5bb9\u3002\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u5c06WebView\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2aexe\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5728Windows\u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002<\/p>\n

\u5c06WebView\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210exe\u7684\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e3a\u4e24\u4e2a\u6b65\u9aa4\uff1a\u9996\u5148\u662f\u5c06Android\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210apk\u6587\u4ef6\uff0c\u7136\u540e\u5c06apk\u6587\u4ef6\u8f6c\u6362\u6210exe\u6587\u4ef6\u3002<\/p>\n

\u7b2c\u4e00\u6b65\uff1a\u6253\u5305apk\u6587\u4ef6<\/p>\n

\u6253\u5305apk\u6587\u4ef6\u7684\u8fc7\u7a0b\u548c\u666e\u901a\u7684Android\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u8fc7\u7a0b\u7c7b\u4f3c\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

1. \u521b\u5efa\u4e00\u4e2aAndroid\u5e94\u7528\u7a0b\u5e8f\u9879\u76ee\uff0c\u5e76\u5c06WebView\u63a7\u4ef6\u6dfb\u52a0\u5230\u4e3b\u754c\u9762\u4e2d\u3002<\/p>\n

2. \u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5fc5\u8981\u7684\u6743\u9650\u548c\u914d\u7f6e\uff0c\u5982\u4e0b\uff1a<\/p>\n

“`<\/p>\n<\/p>\n

android:minSdkVersion=”21″<\/p>\n

android:targeahk\u6253\u5305exe<\/a>tSdkVersion=”29″ \/><\/p>\n<\/p>\n

android:allowBackup=”true”<\/p>\n

android:icon=”@mipmap\/ic_launcher”<\/p>\n

android:label=”@string\/app_name”<\/p>\n

android:roundIcon=”@mipmap\/ic_launcher_round”<\/p>\n

android:supportsRtl=”true”<\/p>\n

android:theme=”@style\/AppTheme”><\/p>\n

\n

\n<\/p>\n

“`<\/p>\n

3. \u5728MainActivity.java\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7f51\u9875\uff0c\u5982\u4e0b\uff1a<\/p>\n

“`<\/p>\n

WebView webView = (WebView) findViewById(R.id.web_view);<\/p>\n

webView.loadUrl(“http:\/\/www.example.com”);<\/p>\n

“`<\/p>\n

4. \u5728bu<\/p>\n

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

ild.gradle\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4f9d\u8d56exe\u6587\u4ef6\u5c01\u88c5\u6253\u5305<\/a>\u9879\uff0c\u5982\u4e0b\uff1a<\/p>\n

“`<\/p>\n

dependencies {<\/p>\n

implementation ‘androidx.appcompat:appcompat:1.1.0’<\/p>\n

implementation ‘androidx.constraintlayout:constraintlayout:1.1.3’<\/p>\n

implementation ‘androidx.legacy:legacy-support-v4:1.0.0’<\/p>\n

}<\/p>\n

“`<\/p>\n

5. \u4f7f\u7528Android Studio\u8fdb\u884c\u6253\u5305\uff0c\u751f\u6210apk\u6587\u4ef6\u3002<\/p>\n

\u7b2c\u4e8c\u6b65\uff1a\u8f6c\u6362\u6210exe\u6587\u4ef6<\/p>\n

\u5c06apk\u6587\u4ef6\u8f6c\u6362\u6210exe\u6587\u4ef6\u9700\u8981\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\uff0c\u5982\u4e0b\uff1a<\/p>\n

1. \u4f7f\u7528apktool\u5c06apk\u6587\u4ef6\u89e3\u538b\u7f29\uff0c\u751f\u6210\u4e00\u4e2a\u6587\u4ef6\u5939\u3002<\/p>\n

2. \u5728\u6587\u4ef6\u5939\u4e2d\u627e\u5230AndroidManifest.xml\u6587\u4ef6\uff0c\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u5e76\u4fee\u6539\uff0c\u5c06\u5176\u4e2d\u7684\u201caction.MAIN\u201d\u548c\u201ccategory.LAUNCHER\u201d\u5220\u9664\u3002<\/p>\n

3. \u5728\u6587\u4ef6\u5939\u4e2d\u627e\u5230lib\u6587\u4ef6\u5939\uff0c\u5c06\u5176\u4e2d\u7684armeabi-v7a\u6587\u4ef6\u5939\u5220\u9664\u3002<\/p>\n

4. \u4f7f\u7528Launch4j\u5c06\u6587\u4ef6\u5939\u6253\u5305\u6210exe\u6587\u4ef6\u3002<\/p>\n

5. \u4f7f\u7528Inno Setup\u7f16\u5199\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5c06exe\u6587\u4ef6\u548c\u76f8\u5173\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n

\u603b\u7ed3<\/p>\n

\u5c06WebView\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210exe\u6587\u4ef6\u9700\u8981\u4e00\u4e9b\u989d\u5916\u7684\u6b65\u9aa4\uff0c\u4f46\u6574\u4e2a\u8fc7\u7a0b\u5e76\u4e0d\u590d\u6742\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8eWebView\u662fAndroid\u7cfb\u7edf\u63d0\u4f9b\u7684\u63a7\u4ef6\uff0c\u56e0\u6b64\u5728Windows\u7cfb\u7edf\u4e0a\u8fd0\u884c\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u9002\u914d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

WebView\u662fAndroid\u7cfb\u7edf\u63d0\u4f9b\u7684\u4e00\u4e2a\u63a7\u4ef6\uff0c\u53ef\u4ee5\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5d4c\u5165\u7f51\u9875\uff0c\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u5c55\u793a\u7f51\u9875\u5185\u5bb9\u3002\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u5c06WebView\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2aexe\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5728Windows<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[20022,4153,12,16,3399],"topic":[],"class_list":["post-16867","post","type-post","status-publish","format-standard","hentry","category-exekf","tag-windows","tag-axureexe","tag-12","tag-16","tag-3399"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/16867","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=16867"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/16867\/revisions"}],"predecessor-version":[{"id":16883,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/16867\/revisions\/16883"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=16867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=16867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=16867"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=16867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}