{"id":45696,"date":"2025-10-23T11:55:04","date_gmt":"2025-10-23T03:55:04","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=45696"},"modified":"2025-10-23T11:55:04","modified_gmt":"2025-10-23T03:55:04","slug":"mt%e6%89%93%e5%8c%85apk%e6%93%8d%e4%bd%9c%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2025\/appkfa\/45696\/","title":{"rendered":"mt\u6253\u5305apk\u64cd\u4f5c\u65b9\u6cd5"},"content":{"rendered":"<p>MT\u6253\u5305APK\u662f\u4e00\u79cd\u5c06\u591a\u4e2aAPK\u5408\u5e76\u4e3a\u4e00\u4e2aAPK\u7684\u6280\u672f\uff0c\u4e3b\u8981\u7528\u4e8e\u6e38\u620f\u5f00\u53d1\u6216\u8005\u5927\u578b\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002\u6253\u5305\u540e\u7684APK\u6587\u4ef6\u53ef\u4ee5\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u7684\u4e0b\u8f7d\u91cf\uff0c\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\uff0c\u540c\u65f6\u4e5f\u53ef\u4ee5\u51cf\u5c11\u5f00\u53d1\u4eba\u5458\u7684\u5de5\u4f5c\u91cf\u3002\u672c\u6587\u5c06\u4ecb\u7ecdMT\u6253\u5305APK\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<p>\u4e00\u3001MT\u6253\u5305APK\u7684\u539f\u7406<\/p>\n<p>MT\u6253\u5305APK\u7684\u539f\u7406\u662f\u5c06\u591a\u4e2aAPK\u6587\u4ef6\u5408\u5e76\u4e3a\u4e00\u4e2aAPK\u6587\u4ef6\uff0c\u4ece\u800c\u51cf\u5c11APK\u6587\u4ef6\u7684\u6570\u91cf\uff0c\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u4e0b\u8f7d\u901f\u5ea6\u548c\u7528\u6237\u4f53\u9a8c\u3002\u5177\u4f53\u5b9e\u73b0\u65b9\u6cd5\u662f\u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e00\u4e2a\u65b0\u7684Application\u8282\u70b9\uff0c\u5728\u8fd9\u4e2a\u8282\u70b9\u4e2d\u5b9a\u4e49\u591a\u4e2aActivity\u8282\u70b9\uff0c\u6bcf\u4e2aActivity\u8282\u70b9\u5bf9\u5e94\u4e00\u4e2aAPK\u6587\u4ef6\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u5c06\u591a\u4e2aAPK\u6587\u4ef6\u5408\u5e76\u4e3a\u4e00\u4e2aAPK\u6587\u4ef6\u3002<\/p>\n<p>\u4e8c\u3001MT\u6253\u5305APK\u7684\u6b65\u9aa4<\/p>\n<p>1. \u521b\u5efa\u4e00\u4e2a\u65b0\u7684Android\u5de5\u7a0b<\/p>\n<p>\u9996\u5148\u9700\u8981\u5728Android Studio\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Android\u5de5\u7a0b\uff0c\u547d\u540d\u4e3aMT\u6253\u5305APK\u3002<\/p>\n<p>2. \u5bfc\u5165\u9700\u8981\u6253\u5305\u7684APK\u6587\u4ef6<\/p>\n<p>\u5c06\u9700\u8981\u6253\u5305\u7684APK\u6587\u4ef6\u590d\u5236\u5230\u5de5\u7a0b\u76ee\u5f55\u4e0b\u7684libs\u6587\u4ef6\u5939\u4e2d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p>3. \u4fee\u6539build.gradle\u6587\u4ef6<\/p>\n<p>\u5728build.gradle\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff0c\u7528\u4e8e\u6253\u5305\u591a\u4e2aAPK\u6587\u4ef6\u3002<\/p>\n<p>&#8220;`gradle<\/p>\n<p>android {<\/p>\n<p>    &#8230;<\/p>\n<p>    sourceSets {<\/p>\n<p>        main {<\/p>\n<p>            jniLibs.srcDirs = [&#8216;libs&#8217;]<\/p>\n<p>        }<\/p>\n<p>    }<\/p>\n<p>    &#8230;<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>4. \u521b\u5efa\u65b0\u7684Application\u8282\u70b9<\/p>\n<p>\u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Application\u8282\u70b9\uff0c\u7528\u4e8e\u5b9a\u4e49\u591a\u4e2aActivity\u8282\u70b9\u3002<\/p>\n<p>&#8220;`xml<\/p>\n<\/p>\n<p>    android:name=&#8221;.App&#8221;<\/p>\n<p>    android:icon=&#8221;@mipmap\/ic_launcher&#8221;<\/p>\n<p>    android:label=&#8221;@string\/app_name&#8221;<\/p>\n<p>    android:theme=&#8221;@style\/AppTheme&#8221;&gt;<\/p>\n<p><p>&#8220;`<\/p>\n<p>5. \u521b\u5efa\u591a\u4e2aActivity\u8282\u70b9<\/p>\n<p>\u5728\u65b0\u7684Application\u8282\u70b9\u4e2d\u521b\u5efa\u591a\u4e2aActivity\u8282\u70b9\uff0c\u6bcf\u4e2aActivity\u8282\u70b9\u5bf9\u5e94\u4e00\u4e2aAPK\u6587\u4ef6\u3002<\/p>\n<p>&#8220;`xml<\/p>\n<\/p>\n<p>    &#8230;<\/p>\n<p>    &gt;<\/p>\n<\/p>\n<p>        android:name=&#8221;.MainActivity&#8221;<\/p>\n<p>        android:label=&#8221;@string\/app_name&#8221;&gt;<\/p>\n<\/p>\n<p>            android:name=&#8221;com.mt.apk.file&#8221;<\/p>\n<p>            android:value=&#8221;lib1.apk&#8221; \/&gt;<\/p>\n<\/p>\n<p>        android:name=&#8221;.SecondActivity&#8221;<\/p>\n<p>        android:label=&#8221;@string\/app_name&#8221;&gt;<\/p>\n<\/p>\n<p>            android:name=&#8221;com.mt.apk.file&#8221;<\/p>\n<p>            android:value=&#8221;lib2.apk&#8221; \/&gt;<\/p>\n<\/p>\n<p>    &#8230;<\/p>\n<p><p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0cmeta-data\u8282\u70b9\u7528\u4e8e\u6307\u5b9a\u5bf9\u5e94\u7684APK\u6587\u4ef6\uff0candroid:name\u5c5e\u6027\u56fa\u5b9a\u4e3acom.mt.apk.file\uff0candroid:value\u5c5e\u6027\u4e3aAPK\u6587\u4ef6\u540d\u3002<\/p>\n<p>6. \u4fee\u6539Application\u7c7b<\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Application\u7c7b\uff0c\u7528\u4e8e\u52a0\u8f7d\u5e76\u542f\u52a8APK\u6587\u4ef6\u3002<\/p>\n<p>&#8220;`java<\/p>\n<p>public class App extends Application {<\/p>\n<p>    @Override<\/p>\n<p>    protected void attachBaseContext(Context base) {<\/p>\n<p>        super.attachBaseContext(base);<\/p>\n<p>        loadApk(base, &#8220;lib1.apk&#8221;);<\/p>\n<p>        loadApk(base, &#8220;lib2.apk&#8221;);<\/p>\n<p>    }<\/p>\n<p>    private void loadApk(Context context, String apkName) <\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/15\/20253615691.jpg\" \/><\/figure>\n<\/p>\n<p>{<\/p>\n<p>        try {<\/p>\n<p>            String path = context.getFilesDir().getAbsolutePath() + File.separator + apkName;<\/p>\n<p>            File file = new File(path);<\/p>\n<p>            if (!file.exists()) {<\/p>\n<p>                InputStream is = context.getAssets().open(apkName);<\/p>\n<p>                FileOutputStream fos = new FileOutputStream(file);<\/p>\n<p>                byte[] buffer = new byte[1024];<\/p>\n<p>                int c<a href=\"https:\/\/www.yimenapp.net\/dabao-793.html\">APP\u8df3APP\u53ef\u4ee5<\/a>ount;<\/p>\n<p>                while ((count = is.read(buffer)) != -1) {<\/p>\n<p>                    fos.write(buffer, 0, count);<\/p>\n<p>                }<\/p>\n<p>                fos.close();<\/p>\n<p>                is.close();<\/p>\n<p>            }<\/p>\n<p>            DexClassLoader classLoader = new DexClassLoader(path, context.getCacheDir().getAbsolutePath(), null, getClassLoader());<\/p>\n<p>            Class clazz = classLoader.loadClass(&#8220;com.mt.apk.MainActivity&#8221;);<\/p>\n<p>            Intent intent = new Intent(context, clazz);<\/p>\n<p>            int<a href=\"https:\/\/www.yimenapp.net\/dabao-2447.html\">\u6253\u5305ios\u8f6f\u4ef6<\/a>ent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<\/p>\n<p>            context.startActivity(intent);<\/p>\n<p>        } catch (Exception e) {<\/p>\n<p>            e.printStackTrace();<\/p>\n<p>        }<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728attachBaseContext\u65b9\u6cd5\u4e2d\u52a0\u8f7d\u5e76\u542f\u52a8APK\u6587\u4ef6\uff0cloadApk\u65b9\u6cd5\u7528\u4e8e\u52a0\u8f7dAPK\u6587\u4ef6\uff0c\u521b\u5efaDexClassLoader\u5bf9\u8c61\uff0c\u52a0\u8f7dMainActivity\u7c7b\uff0c\u5e76\u542f\u52a8Activity\u3002<\/p>\n<p>7. \u6253\u5305APK\u6587\u4ef6<\/p>\n<p>\u6700\u540e\uff0c\u5728Android Studio\u4e2d\u70b9\u51fbBuild -&gt; Build APK\uff0c\u751f\u6210MT\u6253\u5305\u540e\u7684APK\u6587\u4ef6\u3002<\/p>\n<p>\u4e09\u3001\u603b\u7ed3<\/p>\n<p>MT\u6253\u5305APK\u662f\u4e00\u79cd\u5c06\u591a\u4e2aAPK\u5408\u5e76\u4e3a\u4e00\u4e2aAPK\u7684\u6280\u672f\uff0c\u4e3b\u8981\u7528\u4e8e\u6e38\u620f\u5f00\u53d1\u6216\u8005\u5927\u578b\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002\u901a\u8fc7\u5728AndroidManifest.xml\u6587\u4ef6\u4e2d\u5b9a\u4e49\u591a\u4e2aActivity\u8282\u70b9\uff0c\u6bcf\u4e2aActivity\u8282\u70b9\u5bf9\u5e94\u4e00\u4e2aAPK\u6587\u4ef6\uff0c\u518d\u901a\u8fc7\u521b\u5efa\u65b0\u7684Application\u8282\u70b9\u548cApplication\u7c7b\u6765\u52a0\u8f7d\u548c\u542f\u52a8APK\u6587\u4ef6\uff0c\u4ece\u800c\u5b9e\u73b0\u591a\u4e2aAPK\u6587\u4ef6\u7684\u5408\u5e76\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MT\u6253\u5305APK\u662f\u4e00\u79cd\u5c06\u591a\u4e2aAPK\u5408\u5e76\u4e3a\u4e00\u4e2aAPK\u7684\u6280\u672f\uff0c\u4e3b\u8981\u7528\u4e8e\u6e38\u620f\u5f00\u53d1\u6216\u8005\u5927\u578b\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002\u6253\u5305\u540e\u7684APK\u6587\u4ef6\u53ef\u4ee5\u51cf\u5c11\u5e94\u7528\u7a0b\u5e8f\u7684\u4e0b\u8f7d\u91cf\uff0c\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\uff0c\u540c\u65f6\u4e5f\u53ef\u4ee5\u51cf\u5c11\u5f00\u53d1\u4eba\u5458\u7684\u5de5\u4f5c\u91cf\u3002\u672c\u6587\u5c06\u4ecb\u7ecdM<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[35110,474,81,1427,5145],"topic":[],"class_list":["post-45696","post","type-post","status-publish","format-standard","hentry","category-appkfa","tag-apk-","tag-474","tag-81","tag-app","tag-5145"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/45696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=45696"}],"version-history":[{"count":1,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/45696\/revisions"}],"predecessor-version":[{"id":45719,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/45696\/revisions\/45719"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=45696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=45696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=45696"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=45696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}