{"id":272009,"date":"2023-05-13T20:07:04","date_gmt":"2023-05-13T12:07:04","guid":{"rendered":"https:\/\/lrxjmw.cn\/lbyacxqsg.html"},"modified":"2023-05-13T20:07:04","modified_gmt":"2023-05-13T12:07:04","slug":"lbyacxqsg","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lbyacxqsg.html","title":{"rendered":"Linux\u7f16\u8bd1Android\u7a0b\u5e8f\uff0c\u8f7b\u677eget\uff01"},"content":{"rendered":"

\u5728Android\u5f00\u53d1\u4e2d\uff0c\u7f16\u8bd1\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u73af\u8282\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Linux<\/a>\u4e0b\u7f16\u8bd1Android\u7a0b\u5e8f\u3002\u6211\u4eec\u5c06\u4ece\u57fa\u7840\u6982\u5ff5\u6df1\u5ea6linux\u7cfb\u7edf\uff0c\u5230\u73af\u5883\u914d\u7f6e\uff0c\u518d\u5230\u7f16\u8bd1\u6d41\u7a0b\uff0c\u4e00\u6b65\u6b65\u4e3a\u60a8\u8bb2\u89e3\u3002\u5e0c\u671b\u80fd\u5e2e\u52a9\u5e7f\u5927\u5f00\u53d1\u8005\u66f4\u597d\u5730\u638c\u63e1Android\u5f00\u53d1\u6280\u80fd\u3002<\/p>\n

\u7b2c\u4e00\u90e8\u5206\uff1a\u57fa\u7840\u6982\u5ff5<\/b><\/p>\n

\u5728\u5f00\u59cb\u7f16\u8bd1\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3\u4e00\u4e9b\u57fa\u672c\u6982\u5ff5\u3002<\/p>\n

1. Android\u6e90\u7801<\/p>\n

Android\u6e90\u7801\u662f\u6307\u5305\u542b\u6240\u6709Android\u7cfb\u7edf<\/a>\u7ec4\u4ef6\u7684\u4ee3\u7801\u5e93\u3002\u5b83\u5305\u542b\u4e86\u64cd\u4f5c\u7cfb\u7edf\u3001\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6\u4ee5\u53ca\u5404\u79cd\u5e94\u7528\u7a0b\u5e8f\u7b49\u3002\u6211\u4eec\u9700\u8981\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684\u6e90\u7801\u3002<\/p>\n

2.\u7f16\u8bd1\u5668<\/p>\n

\u7f16\u8bd1\u5668\u662f\u5c06\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u4ee3\u7801\u7684\u5de5\u5177\u3002\u5728Linux\u4e0b\uff0c\u901a\u5e38\u4f7f\u7528GCC\u4f5c\u4e3a\u7f16\u8bd1\u5668\u3002<\/p>\n

3. ndk-build<\/p>\n

ndk-build\u662f\u4e00\u4e2a\u811a\u672c\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u81ea\u52a8\u5316\u6784\u5efaNDK\u9879\u76ee\u3002\u5b83\u53ef\u4ee5\u6839\u636eAndroid.mk\u6587\u4ef6\u6765\u81ea\u52a8\u5316\u6784\u5efa\u9879\u76ee\uff0c\u5e76\u751f\u6210so\u5e93\u3002<\/p>\n

cocos2dx 30 android \u7f16\u8bd1_linux\u7f16\u8bd1android\u7a0b\u5e8f_linux\u7a0b\u5e8f\u79fb\u690d\u5230android<\/p>\n

\u7b2c\u4e8c\u90e8\u5206\uff1a\u73af\u5883\u914d\u7f6e<\/b><\/p>\n

\u5728\u5f00\u59cb\u7f16\u8bd1\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u914d\u7f6e\u597d\u5f00\u53d1\u73af\u5883\u3002<\/p>\n

1.\u5b89\u88c5Java JDK<\/p>\n

Android SDK\u9700\u8981Java JDK\u652f\u6301\u3002\u53ef\u4ee5\u4eceOracle\u5b98\u7f51\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684JDK\u5e76\u5b89\u88c5\u3002<\/p>\n

2.\u5b89\u88c5Android SDK<\/p>\n

Android SDK\u662fAndroid\u5f00\u53d1\u7684\u6838\u5fc3\u7ec4\u4ef6\u3002\u53ef\u4ee5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684SDK\u5e76\u5b89\u88c5\u3002<\/p>\n

3.\u5b89\u88c5NDK<\/p>\n

linux\u7f16\u8bd1android\u7a0b\u5e8f_linux\u7a0b\u5e8f\u79fb\u690d\u5230android_cocos2dx 30 android \u7f16\u8bd1<\/p>\n

NDK\u662f\u7528\u4e8e\u7f16\u8bd1C\/C++\u4ee3\u7801\u7684\u5de5\u5177\u3002\u53ef\u4ee5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684NDK\u5e76\u5b89\u88c5\u3002<\/p>\n

4.\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n

\u5728Linux\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u7f6eJAVA_HOME\u3001ANDROID_HOME\u3001NDK_HOME\u7b49\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u7cfb\u7edf\u80fd\u591f\u8bc6\u522b\u76f8\u5173\u547d\u4ee4<\/a>\u3002<\/p>\n

\u7b2c\u4e09\u90e8\u5206\uff1a\u7f16\u8bd1\u6d41\u7a0b<\/b><\/p>\n

\u5728\u5b8c\u6210\u73af\u5883\u914d\u7f6e\u540elinux\u7f16\u8bd1android\u7a0b\u5e8f<\/strong>linux vi \u547d\u4ee4\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u7f16\u8bd1\u4e86\u3002<\/p>\n

1.\u4e0b\u8f7d\u6e90\u7801<\/p>\n

\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u7684\u6e90\u7801\uff0c\u5e76\u89e3\u538b\u5230\u6307\u5b9a\u76ee\u5f55\u3002<\/p>\n

2.\u914d\u7f6e\u73af\u5883<\/p>\n

\u8fdb\u5165\u6e90\u7801\u76ee\u5f55\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\nsource build\/envsetup.sh\nlunch\n<\/pre>\n<\/p>\n

3.\u7f16\u8bd1\u7cfb\u7edf\u955c\u50cf<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u7cfb\u7edf\u955c\u50cf\uff1a<\/p>\n

\n

\nmake -j8\n<\/pre>\n<\/p>\n

4.\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n

\n

\nmm -j8\n<\/pre>\n<\/p>\n

5.\u751f\u6210APK\u6587\u4ef6<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u751f\u6210APK\u6587\u4ef6\uff1a<\/p>\n

\n

\ncd out\/target\/product\/generic\/\nmake snod\n<\/pre>\n<\/p>\n

6.\u7f16\u8bd1C\/C++\u4ee3\u7801<\/p>\n

\u4f7f\u7528ndk-build\u5de5\u5177\u6765\u7f16\u8bd1C\/C++\u4ee3\u7801\u3002\u6211\u4eec\u9700\u8981\u5148\u5728Android.mk\u6587\u4ef6\u4e2d\u6307\u5b9a\u8981\u7f16\u8bd1\u7684\u6e90\u6587\u4ef6\u548c\u8f93\u51fa\u76ee\u5f55\uff0c\u7136\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

linux\u7a0b\u5e8f\u79fb\u690d\u5230android_cocos2dx 30 android \u7f16\u8bd1_linux\u7f16\u8bd1android\u7a0b\u5e8f<\/p>\n

\n

\ncd jni\/\nndk-build\n<\/pre>\n<\/p>\n

7.\u751f\u6210so\u5e93<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u751f\u6210so\u5e93\uff1a<\/p>\n

\n

\ncd libs\/\n<\/pre>\n<\/p>\n

8.\u8c03\u8bd5\u7a0b\u5e8f<\/p>\n

\u53ef\u4ee5\u4f7f\u7528gdb\u6765\u8c03\u8bd5\u7a0b\u5e8f\u3002\u6211\u4eec\u9700\u8981\u5728\u7f16\u8bd1\u65f6\u52a0\u4e0a-g\u9009\u9879\uff0c\u5e76\u4f7f\u7528gdbserver\u6765\u542f\u52a8\u7a0b\u5e8f\u3002<\/p>\n

9.\u8fd0\u884c\u7a0b\u5e8f<\/p>\n

\u5c06APK\u6587\u4ef6\u5b89\u88c5\u5230Android\u6a21\u62df\u5668\u6216\u771f\u673a\u4e0alinux\u7f16\u8bd1android\u7a0b\u5e8f<\/strong>\uff0c\u5373\u53ef\u8fd0\u884c\u7a0b\u5e8f\u3002<\/p>\n

\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728Linux\u4e0b\u7f16\u8bd1Android\u7a0b\u5e8f\u4e86\u3002\u5f53\u7136\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u8fd8\u6709\u5f88\u591a\u7ec6\u8282\u9700\u8981\u6ce8\u610f\uff0c\u4f8b\u5982\u73af\u5883\u914d\u7f6e\u3001\u8def\u5f84\u8bbe\u7f6e\u7b49\u7b49\u3002\u5e0c\u671b\u672c\u6587\u80fd\u591f\u5bf9\u5e7f\u5927\u5f00\u53d1\u8005\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7f16\u8bd1\u5668\u662f\u5c06\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u4ee3\u7801\u7684\u5de5\u5177\u3002ndk-build\u662f\u4e00\u4e2a\u811a\u672c\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u81ea\u52a8\u5316\u6784\u5efaNDK\u9879\u76ee\u3002NDK\u662f\u7528\u4e8e\u7f16\u8bd1C\/C++\u4ee3\u7801\u7684\u5de5\u5177\u3002\u7b2c\u4e09\u90e8\u5206\uff1a\u7f16\u8bd1\u6d41\u7a0b\u7f16\u8bd1\u7cfb\u7edf\u955c\u50cf\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u7cfb\u7edf\u955c\u50cf\uff1a\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\uff1a\u7f16\u8bd1C\/C++\u4ee3\u7801\u4f7f\u7528ndk-build\u5de5\u5177\u6765\u7f16\u8bd1C\/C++\u4ee3\u7801\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728Linux\u4e0b\u7f16\u8bd1Android\u7a0b\u5e8f\u4e86\u3002<\/p>\n","protected":false},"author":1,"featured_media":272010,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-272009","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/272009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=272009"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/272009\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/272010"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=272009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=272009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=272009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}