{"id":207361,"date":"2025-07-08T10:22:07","date_gmt":"2025-07-08T02:22:07","guid":{"rendered":"https:\/\/server.hk\/cnblog\/207361\/"},"modified":"2025-07-08T10:22:07","modified_gmt":"2025-07-08T02:22:07","slug":"gomobile%e5%ba%93%e4%bd%bf%e7%94%a8%e9%9a%90%e8%97%8f%e7%9a%84api%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/207361\/","title":{"rendered":"Gomobile\u5e93\u4f7f\u7528\u9690\u85cf\u7684API\u65b9\u6cd5"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>Gomobile\u5e93\u4f7f\u7528\u9690\u85cf\u7684API\u65b9\u6cd5<\/span><\/p>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-21 22:42:32<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aGomobile\u5e93\u4f7f\u7528\u9690\u85cf\u7684API\u65b9\u6cd5\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">Golang<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6211\u6709\u4e00\u4e2a <strong>android<\/strong> \u5e94\u7528\u7a0b\u5e8f\uff0c\u5b83\u4f7f\u7528\u4f7f\u7528 <strong>gomobile<\/strong> \u521b\u5efa\u7684 <strong>golang<\/strong> \u5e93 (<strong>.aar<\/strong>)\u3002\u6bcf\u5f53\u5e94\u7528\u7a0b\u5e8f\u5c1d\u8bd5\u4ece\u5e93\u521b\u5efa\u7c7b\u7684\u5b9e\u4f8b\u6216\u8c03\u7528\u5e93\u65b9\u6cd5\u65f6\uff0c\u5b83\u90fd\u4f1a\u5d29\u6e83\u5e76\u663e\u793a\u4e0b\u4e00\u6761\u65e5\u5fd7\u6d88\u606f\uff1a<\/p>\n<pre>w\/om.example.cal: accessing hidden method landroid\/app\/appglobals;-&gt;getinitialapplication()landroid\/app\/application; (greylist, reflection, allowed)\na\/libc: fatal signal 6 (sigabrt), code -1 (si_queue) in tid 11110 (om.example.calc), pid 11075 (om.example.calc)\napplication terminated.<\/pre>\n<p><code>getinitialapplication<\/code> \u65b9\u6cd5\u4f4d\u4e8e google \u7684\u6d45\u7070\u540d\u5355\u4e2d\uff08\u7b2c 349 \u884c\uff09\u3002 \u6211\u77e5\u9053\u5728 sdk \u7248\u672c 28 \u53ca\u66f4\u9ad8\u7248\u672c\u4e0a\u4e0d\u53ef\u80fd\u8bbf\u95ee\u4efb\u4f55\u9690\u85cf\u65b9\u6cd5\uff0c\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u6211\u5728 <code>build.gradle<\/code> \u4e2d\u7f16\u5199\u4e0b\u4e00\u4e2a\uff0826 \u662f <strong>play market<\/strong> \u7684\u6700\u4f4e\u7248\u672c\uff09\uff1a<\/p>\n<pre>compileSdkVersion 26\nminSdkVersion 15\ntargetSdkVersion 26\nimplementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])\nimplementation 'com.android.support:appcompat-v7:26.1.0'<\/pre>\n<p>\u4f46\u8fd9\u5e76\u6ca1\u6709\u5e2e\u52a9\u3002\u5982\u4f55\u8ba9\u5b83\u53d1\u6325\u4f5c\u7528\uff1f \u5907\u6ce8\uff1a\u6d4b\u8bd5\u8bbe\u5907\u662f\u5728 <strong>ubuntu 18.04<\/strong> \u4e0a\u6a21\u62df <strong>nexus s<\/strong>\u3002<\/p>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u95ee\u9898\u662f\u6211\u5728\u6a21\u62df\u5668\u4e0a\u8c03\u8bd5\u4e86\u6211\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u663e\u7136\uff0c\u5b83\u4e0e\u672c\u673a\u5e93\u4e0d\u517c\u5bb9\u3002\u5728\u624b\u673a\u4e0a\u8c03\u8bd5\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300aGomobile\u5e93\u4f7f\u7528\u9690\u85cf\u7684API\u65b9\u6cd5\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03Golang\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-207361","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=207361"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207361\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=207361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=207361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=207361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}