{"id":76674,"date":"2026-01-16T11:53:27","date_gmt":"2026-01-16T03:53:27","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=76674"},"modified":"2026-01-16T11:53:27","modified_gmt":"2026-01-16T03:53:27","slug":"android-%e5%bc%80%e5%8f%91%e6%9f%a5%e7%9c%8bapk%e7%9a%84%e6%b8%a0%e9%81%93%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/76674\/","title":{"rendered":"android \u5f00\u53d1\u67e5\u770bapk\u7684\u6e20\u9053\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5728 Android \u5f00\u53d1\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u67e5\u770b APK \u7684<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%b8%a0%e9%81%93\/\" title=\"\u6e20\u9053\" target=\"_blank\">\u6e20\u9053<\/a><\/span><span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e4%bf%a1%e6%81%af\/\" title=\"\u4fe1\u606f\" target=\"_blank\">\u4fe1\u606f<\/a><\/span>\uff0c\u4ee5\u4fbf\u8fdb\u884c\u6570\u636e\u7edf\u8ba1\u548c\u5206\u6790\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u67e5\u770b APK \u7684\u6e20\u9053\u4fe1\u606f\uff0c\u5305<a href=\"https:\/\/www.yimenapp.net\/dabao-667.html\">Windows\u6d4f\u89c8\u5668ua<\/a>\u62ec\u539f\u7406\u548c\u5177\u4f53\u5b9e\u73b0\u65b9\u6cd5\u3002<\/p>\n<p>\u4e00\u3001\u539f\u7406<\/p>\n<p>Android <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f\/\" title=\"\u5e94\u7528\u7a0b\u5e8f\" target=\"_blank\">\u5e94\u7528\u7a0b\u5e8f<\/a><\/span>\u6253\u5305\u540e\uff0c\u4f1a\u751f\u6210 APK \u6587\u4ef6\u3002APK \u6587\u4ef6\u662f\u4e00\u4e2a ZIP \u538b\u7f29\u5305\uff0c\u5305\u542b\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u6240\u6709\u8d44\u6e90\u548c\u4ee3\u7801\u3002\u5728 APK \u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bfb\u53d6 AndroidManifest.xml \u6587\u4ef6\u6765\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u5305\u62ec\u5e94\u7528\u7a0b\u5e8f\u7684\u7248\u672c\u53f7\u3001\u5305\u540d\u3001\u6743\u9650\u7b49\u4fe1\u606f\u3002<\/p>\n<p>\u5728 AndroidManifest.xml \u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7684 meta-data \u5143\u7d20\uff0c\u7528\u4e8e\u5b58\u50a8\u5e94\u7528\u7a0b\u5e8f\u7684\u4e00\u4e9b\u989d\u5916\u4fe1\u606f\u3002\u5176\u4e2d\uff0c\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3a CHANNEL \u7684 meta-data \u5143\u7d20\uff0c\u7528\u4e8e\u5b58\u50a8\u5e94\u7528\u7a0b\u5e8f\u7684\u6e20\u9053\u4fe1\u606f\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bfb\u53d6\u8fd9\u4e2a meta-data \u5143\u7d20\u6765\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u6e20\u9053\u4fe1\u606f\u3002<\/p>\n<p>\u4e8c\u3001\u5b9e\u73b0\u65b9\u6cd5<\/p>\n<p>1. \u5728 AndroidManifest.xml \u6587\u4ef6\u4e2d\u6dfb\u52a0 CHANNEL meta-data \u5143\u7d20<\/p>\n<p>\u5728 AndroidManifest.xml \u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a meta-data \u5143\u7d20\uff0c\u7528\u4e8e\u5b58\u50a8\u5e94\u7528\u7a0b\u5e8f\u7684\u6e20\u9053\u4fe1\u606f\u3002\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<\/p>\n<p>    android:name=&#8221;.MyApplication&#8221;<\/p>\n<p>    android:allowBackup=&#8221;true&#8221;<\/p>\n<p>    android:icon=&#8221;@mipmap\/ic_launcher&#8221;<\/p>\n<p>    android:label=&#8221;@string\/<span class=\"wpcom_keyword_link\"><a href=\"https:\/\/www.yimenapp.com\" target=\"_blank\" title=\"\u5f00\u53d1app\u4ece\u4e00\u95e8\u5f00\u59cb\">app<\/a><\/span>_name&#8221;<\/p>\n<p>    android:roundIco<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/16\/14146498474.jpg\" \/><\/figure><\/p>\n<p>n=&#8221;@mipmap\/ic_launcher_round&#8221;<\/p>\n<p>    android:supportsRtl=&#8221;true&#8221;<\/p>\n<p>    android:theme=&#8221;@style\/AppTheme&#8221;&gt;<\/p>\n<\/p>\n<p>        android:name=&#8221;CHANNEL&#8221;<\/p>\n<p>        android:value=&#8221;\u6e20\u9053\u540d\u79f0&#8221; \/&gt;<\/p>\n<p>    &#8230;<\/p>\n<p><p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0candroid:name \u5c5e\u6027\u6307\u5b9a meta-data \u5143\u7d20\u7684\u540d\u79f0\u4e3a CHANNEL\uff0candroid:value \u5c5e\u6027\u6307\u5b9a\u6e20\u9053\u540d\u79f0\u3002<\/p>\n<p>2. \u901a\u8fc7\u4ee3\u7801\u83b7\u53d6\u6e20\u9053\u4fe1\u606f<\/p>\n<p>\u5728\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bfb\u53d6 meta-data \u5143\u7d20\u6765\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u6e20\u9053\u4fe1\u606f\u3002\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>public static String getChannel(Context context) {<\/p>\n<p>    String channel = &#8220;&#8221;;<\/p>\n<p>    try {<\/p>\n<p>        ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);<\/p>\n<p>        if (appInfo<a href=\"https:\/\/www.yimenapp.net\/dabao-916.html\">\u642d\u5efaipa<\/a> != null &amp;&amp; appInfo.metaData != null) {<\/p>\n<p>            channel = appInfo.metaData.getString(&#8220;CHANNEL&#8221;);<\/p>\n<p>        }<\/p>\n<p>    } catch (PackageManager.NameNotFoundException e) {<\/p>\n<p>        e.printStackTrace();<\/p>\n<p>    }<\/p>\n<p>    return channel;<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0ccontext.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA) \u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684 ApplicationInfo \u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u5305\u542b\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u4fe1\u606f\u548c meta-data \u5143\u7d20\u4fe1\u606f\u3002\u901a\u8fc7 appInfo.metaData.getString(&#8220;CHANNEL&#8221;) \u65b9\u6cd5\u83b7\u53d6\u6e20\u9053\u4fe1\u606f\u3002<\/p>\n<p>3. \u6ce8\u610f\u4e8b\u9879<\/p>\n<p>\u5728\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\u83b7\u53d6\u6e20\u9053\u4fe1\u606f\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<p>&#8211; \u6e20\u9053\u540d\u79f0\u5fc5\u987b\u4e0e AndroidManifest.xml \u6587\u4ef6\u4e2d\u8bbe\u7f6e\u7684\u540d\u79f0\u4e00\u81f4\u3002<\/p>\n<p>&#8211; \u5982\u679c\u6ca1\u6709\u8bbe\u7f6e\u6e20\u9053\u540d\u79f0\uff0c\u5219\u9ed8\u8ba4\u6e20\u9053\u540d\u79f0\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<p>&#8211; \u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u88ab\u6df7\u6dc6\uff0c\u5219\u9700\u8981\u5728 proguard-rules.pro \u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u89c4\u5219\uff0c\u4ee5\u907f\u514d\u6df7\u6dc6 meta-data \u5143\u7d20\u7684\u540d\u79f0\u548c\u503c\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>-keepattributes *Annotation*<\/p>\n<p>-keepclassmembers class ** {<\/p>\n<p>    ** CHANNEL;<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u67e5\u770b APK \u6e20\u9053\u4fe1\u606f\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u53ef\u4ee5\u8f7b\u677e\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u6e20\u9053\u4fe1\u606f\uff0c\u65b9\u4fbf\u8fdb\u884c\u6570\u636e\u7edf\u8ba1\u548c\u5206\u6790\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Android \u5f00\u53d1\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u67e5\u770b APK \u7684\u6e20\u9053\u4fe1\u606f\uff0c\u4ee5\u4fbf\u8fdb\u884c\u6570\u636e\u7edf\u8ba1\u548c\u5206\u6790\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u67e5\u770b APK \u7684\u6e20\u9053\u4fe1\u606f\uff0c\u5305\u62ec\u539f\u7406\u548c\u5177\u4f53\u5b9e\u73b0\u65b9\u6cd5\u3002\u4e00\u3001\u539f\u7406Android \u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u540e\uff0c\u4f1a\u751f<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[45161,1912,36011,2445,2094],"special":[],"attr":[],"class_list":["post-76674","post","type-post","status-publish","format-standard","hentry","category-www","tag-ipa","tag-1912","tag-36011","tag-2445","tag-2094","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/76674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=76674"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/76674\/revisions"}],"predecessor-version":[{"id":76704,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/76674\/revisions\/76704"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=76674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=76674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=76674"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=76674"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=76674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}