{"id":1442,"date":"2014-12-10T22:12:01","date_gmt":"2014-12-10T14:12:01","guid":{"rendered":"https:\/\/www.ookangzheng.com\/?p=1442"},"modified":"2020-05-24T16:00:28","modified_gmt":"2020-05-24T08:00:28","slug":"windows%e4%b8%8b%e9%85%8d%e7%bd%ae-apache-cordova-nodejs-ant-android-sdk","status":"publish","type":"post","link":"https:\/\/www.ookangzheng.com\/windows%e4%b8%8b%e9%85%8d%e7%bd%ae-apache-cordova-nodejs-ant-android-sdk\/","title":{"rendered":"Windows\u4e0b\u914d\u7f6e Apache cordova + NodeJs + Ant + Android Studio(SDK)"},"content":{"rendered":"

\/\/\u5df2\u7d93\u66f4\u65b0Android Studio \u914d\u7f6e\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u5728\u521d\u5b66\u81ea\u5df1\u5236\u4f5cHybirdApp \u4e14\u5e73\u53f0\u4e3aAndroid\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u56e0\u4e3a\u8bbe\u5b9a\u73af\u5883\u53d8\u91cf\u800c\u82e6\u607c\uff0c\u4ee5\u4e0b\u6b65\u9aa4\u662f\u6211\u4e2a\u4eba\u7ecf\u9a8c\uff0c\u8bf7\u8ddf\u7740\u64cd\u4f5c\u5c31\u53ef\u4ee5\u4e86\uff0c\u6709\u95ee\u9898\u7559\u8a00\u54df<\/p>\n

\u4e00\u3001 Apache Ant \u7684\u4e0b\u8f7d<\/p>\n

\u4e0b\u8f7d\u94fe\u63a5\uff1ahttp:\/\/ant.apache.org\/bindownload.cgi<\/p>\n

\u4e0b\u8f7d\u76ee\u524d\u6700\u65b0\u7248 1.9.4 zip\u6863\u6848\uff0c\u4e0b\u8f7d\u4e86\u5e76\u89e3\u538b\u7f29\u5230 D:\\tools\\ant<\/p>\n

\u5728\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u91cc\u9762\u8bbe\u5b9a<\/p>\n

\"apache-ant\"<\/a><\/p>\n

<\/p>\n

\u4e00\u5b9a\u8981\u5728cmd\u547d\u4ee4\u884c\u7a97\u53e3\u8f93\u5165 ant \u547d\u4ee4\uff0c\u770b\u662f\u5426\u62a5\u9519\u3002\u6211\u7684\u8fd9\u4e2a\u5c31\u62a5\u9519\uff1a\u5728jre\u76ee\u5f55\u627e\u4e0d\u5230tools.jar\u3002\u89e3\u51b3\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u81ea\u5df1\u770b\u4e86\u4e00\u4e0bjre\u76ee\u5f55\u662f\u6ca1\u6709\uff0c\u5728jdk\u76ee\u5f55\u4e0blib\u76ee\u5f55\u6709tools.jar\uff0c\u4e8e\u662f\u62f7\u8d1d\u4e00\u4e2a\u8fc7\u53bb\u5c31\u89e3\u51b3\u4e86\u3002<\/p>\n

\u4e8c\u3001 \u5b89\u88c5Java SDK<\/p>\n

\u8bf7\u5230www.java.com\u4e0b\u8f7d\u6700\u65b0\u7684 SDK \u548c Jre<\/p>\n

\u5728\u73af\u5883\u53d8\u91cf\u6dfb\u52a0 JAVA_HOME \u6307\u5230\uff1aC:\\ProgramFiles\\Java\\JDK<\/p>\n

\u5e76\u4e14\u589e\u52a0 %JAVA_HOME%;%JAVA_HOME%\\bin<\/p>\n

\u4e09\u3001\u5b89\u88c5google sdk<\/p>\n

\u5230\u8fd9\u91cc\u4e0b\u8f7d\u00a0http:\/\/developer.android.com\/sdk\/installing\/index.html?pkg=tools<\/p>\n

\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u6211\u662f\u89e3\u538b\u7f29\u5230D:\\tools\\android-sdk<\/p>\n

\u8bbe\u7f6e ANDROID_HOME \u53d8\u91cf<\/p>\n

\"android-home\"<\/a><\/p>\n

\u63a5\u4e0b\u6765\u5728Path \u91cc\u9762\u6dfb\u52a0 platform-tools \u548c tools \u8def\u5f84<\/p>\n

\"android-home-tools\"<\/a><\/p>\n

\n

\u5099\u8a3b\uff1a\u82e5\u662f\u4f7f\u7528Android Studio, \u8acb\u5230\u00a0C:\\Users\\Administrator\\AppData\\Local\\Android\\sdk\\platform-tools \u548c xxx\\tools\u90fd\u52a0\u5165 Path \u91cc;<\/p>\n

\u6700\u540e\u5c1d\u8bd5\u5f00\u542f CMD \uff0c\u8f93\u5165 android \u6307\u4ee4 \u770b\u770b\u662f\u5426\u80fd\u6253\u5f00 SDK Manager , \u6253\u5f00\u540e\uff0c\u8bf7\u52a1\u5fc5\u5b89\u88c5 \u81f3\u5c11\u7248\u672cAPI 19 \u4e3a 4.4.2, Build-Tools\u4e3a 19.1\u7248\u672c\"new<\/a>\u6700\u540e\u5728Build\u7684\u65f6\u5019\u9700\u8981 zipalign\u529f\u80fd\uff0c\u5728\u73af\u5883\u53d8\u91cf\u589e\u52a0<\/p>\n

%ANDROID_HOME%\\build-tools\\19.1.0 \u00a0\/\/\u8fd9\u6837\u624d\u80fd\u4f7f\u7528zipalign -v 4 xxx.apk xxx.apk<\/p>\n

\u4e09\u3001\u5b89\u88c5node.js<\/p>\n

\u8fdb\u5165www.nodejs.org \u4e0b\u8f7d\u6700\u65b0\u7248\u7684msi \u5b89\u88c5\u5305\uff0c\u5b89\u88c5\u5373\u53ef<\/p>\n

\u6700\u540e\u5728cmd \u9a8c\u8bc1 nodejs \u7248\u672c \u53ca java \u8fd9\u4e24\u4e2a\u662f\u5426\u80fd\u8fd0\u884c \u6307\u4ee4\u4e3a\uff1anpm -version \u548c java -version\"chk-npm-java-version\"<\/a><\/p>\n

\u56db\u3001\u6700\u540e\u5b89\u88c5 \u00a0cordova \u4e86<\/p>\n

npm install -g cordova<\/code><\/div>\n
<\/div>\n
\u4e94\u3001\u63a5\u4e0b\u6765\u521b\u5efa app \u53ca\u6253\u5305<\/div>\n
<\/div>\n
\n
\n
cordova <\/span>create<\/span><\/span> myapp com<\/span>.<\/span>org<\/span>.<\/span>myapp <\/span>“HelloWorld”<\/span><\/span><\/div>\n
cd myapp <\/span><\/div>\n
cordova <\/span>platform<\/span><\/span> add<\/span><\/span> android <\/span> \/\/\u6dfb\u52a0android\u8fd0\u884c\u5e73\u53f0<\/span><\/span><\/div>\n
cordova build android <\/span> \/\/\u7f16\u8bd1apk<\/span><\/span><\/div>\n
cordova emulate android <\/span> \/\/\u8c03\u7528adb\u8c03\u8bd5\u5e94\u7528<\/span><\/span><\/div>\n<\/div>\n
<\/div>\n
\u516d\u3001\u5728 myapp \u6863\u6848\u91cc\u9762 \u63d0\u53d6 myapp-debug.apk \u5b89\u88c5\u5230\u4f60\u7684\u624b\u673a\u5c31\u53ef\u4ee5\u9a6c\u4e0a\u4f7f\u7528\u5566<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\/\/\u5df2\u7d93\u66f4\u65b0Android Studio \u914d\u7f6e\u65b9\u6cd5 \u6211\u4eec\u5728\u521d\u5b66\u81ea\u5df1\u5236\u4f5cHybirdApp \u4e14\u5e73\u53f0\u4e3aAndroid\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u56e0\u4e3a\u8bbe\u5b9a\u73af\u5883\u53d8\u91cf\u800c\u82e6\u607c\uff0c\u4ee5\u4e0b\u6b65\u9aa4\u662f\u6211\u4e2a\u4eba\u7ecf\u9a8c\uff0c\u8bf7\u8ddf\u7740\u64cd\u4f5c\u5c31\u53ef\u4ee5\u4e86\uff0c\u6709\u95ee\u9898\u7559\u8a00\u54df \u4e00\u3001 Apache Ant \u7684\u4e0b\u8f7d \u4e0b\u8f7d\u94fe\u63a5\uff1ahttp:\/\/ant.apache.org\/bindownload.cgi \u4e0b\u8f7d\u76ee\u524d\u6700\u65b0\u7248 1.9.4 zip\u6863\u6848\uff0c\u4e0b\u8f7d\u4e86\u5e76\u89e3\u538b\u7f29\u5230 D:\\tools\\ant \u5728\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u91cc\u9762\u8bbe\u5b9a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1442","post","type-post","status-publish","format-standard","hentry","category-life"],"_links":{"self":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/1442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/comments?post=1442"}],"version-history":[{"count":0,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/1442\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media?parent=1442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/categories?post=1442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/tags?post=1442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}