關(guān)鍵詞:egret、eclipse、android、apk、ant
1.正確安裝各種環(huán)境
下載egret engine,egret wing,egret-android-support,adt-bundle,ant,設(shè)置環(huán)境變量
2.創(chuàng)建基本項(xiàng)目
可以在egret-wing里面新建項(xiàng)目,保存在你自己設(shè)定的路徑下(以 /Users/jyx/Documents為例)。也可以使用命令行,先cd到目錄下,然后執(zhí)行 egret create hello(hello是你要?jiǎng)?chuàng)建的項(xiàng)目的名稱)。
3.使用命令行創(chuàng)建對(duì)應(yīng)的移動(dòng)平臺(tái)的native項(xiàng)目
?先cd到 /Users/jyx/Documents 下,然后執(zhí)行下列命令
egret create_app helloAndroid -f hello -t /Users/jyx/Documents/egret-android-support-3.0.3
這樣就會(huì)在hello項(xiàng)目的同一文件夾下創(chuàng)建對(duì)應(yīng)的android項(xiàng)目,叫helloAndroid
4.cd到helloAndroid下的proj.android文件夾,在命令行執(zhí)行下列命令
android update project -p helloAndroid
就會(huì)發(fā)現(xiàn)項(xiàng)目中多了兩個(gè)文件 build.xml 和 local.properties
查看build.xml,其實(shí)里面沒寫啥東西,只是表明這是一個(gè)可以用ant編譯的工程而已。
執(zhí)行ant編譯時(shí),編譯的步驟其實(shí)在adt包下的sdk里面(/tools/ant/build.xml,這個(gè)文件才是構(gòu)建的最重要的文件).
5.在項(xiàng)目目錄下(proj.android)執(zhí)行 ant debug,就會(huì)開始執(zhí)行ant編譯,生成debug版本的apk,生成的apk的位置在終端下會(huì)顯示出來,之后執(zhí)行 adb install xxxxx.apk,就會(huì)將生成的apk安裝到連接的android手機(jī)上。
android update project -p xxxxx
ant clean
ant debug
adb install/reinstall xxx.apk