跳到主要內容

Cordova遇見Genymotion(一):起手式

隨著行動裝置的盛行,行動裝置的開發越來越重要了,大致上可分為Native、Web及Hybird的方式開發,而每種方式都有它的優缺點,Native及Web我就不多說了,大家可以上網查一下,今天我要介紹的是Cordova前身是Phonegap,Hybird的方式,混合了Native及Web的優點,但是可能現在還算是起步中,仍有些地方不足以讓大家使用,不過我想中庸之道始終會是王道。

另外就是我使用的模擬器不是用Android的,而是用Genymotion,用意則是效能及速度,而且也滿簡單的說。

接下來會有幾篇都是介紹Cordova的文章,這次先介紹環境的安裝及設定。



  • 安裝Cordova,可以參考這裡,以下步驟為我安裝的部分可以參考一下囉。
  • 下載node.js並安裝,安裝完後可以執行npm --version確認安裝是否成功及版本
  • 下載並安裝cordova,執行npm install -g cordova,確認是否安裝成功及版本可下cordova --version。

  • 下載Genymotion,並安裝Genymotion,安裝完畢後需要進行Virtual Device下載,現在需要帳號登入才可以選擇裝置,所以申請Genymotion帳號及密碼後,就可以下載你所需的Virtual Device。















  • 我這裡是用Netbeans進行開發,所以先下載Netbeans 8,並安裝Netbeans。安裝完後啟動Netbeans。接下來因為要設定Android SDK,所以先下載Android SDK,並安裝後,在Netbeans中設定Android SDK位置。





  • 進行所有安裝測試囉,先開啟一個新的Cordova專案。







    • 不需要做任何事情,直接編譯專案成功後,先啟動Genymotion的Virtual Device,透過以下指令,把編譯出來的APK安裝上去,有出現會後一個畫面就是表示成功囉。
    Genymotion\tools\adb install -r xxx.apk
    ※若是遇到device not found可以試試,adb connect xxx.xxx.xxx.xxx(可以看看模擬器左上角的IP),在執行安裝指令。














    )

    留言

    這個網誌中的熱門文章

    IReport中的條碼類別BcImage

    最近有一個繳費單的專案,需要列印條碼,因為IReport本身就有提供列印條碼的功能,所以就用IReport設計繳費單然後再用Jasperreport API寫批次程式去產生PDF,資料量大概3000多筆(頁)拆成幾個檔案,可是就發生了一個問題居然發生部分繳費單的條碼有問題,看了一下程式研判是Race Condition因為程式採用的是多執行緒,若是依序個別產生是不會有問題,但是同時執行的時候就會亂掉,而且都錯在條碼,令我覺得很奇怪,後來我查了一下發現it.businesslogic.ireport.barcode.BcImage 類別我猜是這裡的問題,就先加上synchronized重新編譯在去執行,嘿嘿條碼就對了,做了一下壓測也正常,程式碼如下,不過這樣事不是對了可能還要仔細查查看。 public class BcImage { private static net.sourceforge.barbecue.Barcode bc = null; public synchronized static net.sourceforge.barbecue.Barcode getBarcode() { return bc; } public synchronized static BufferedImage getBarcodeImage(int type, Object aText, boolean showText, boolean checkSum) { return getBarcodeImage(type, aText, showText, checkSum,"",0,0); } public synchronized static BufferedImage getBarcodeImage(int type, Object aText, boolean showText, boolean checkSum, String applicationIdentifier, int width, int height) { // 2of7, 3of9, Bookland, Codabar, Code128,...

    IBM MQ 5.3 如何匯出Qmgr

    使用IBM MQ探險家也沒有匯出的功能,這樣其實在一些備份或是Cluster時,滿困擾的,不過你也知道IBM就是喜歡用SupportPacs等等的方式,ms03這個SupportPacs就是可以匯出Qmgr中所有的資訊也可以選擇想要的,以下是他的連結 http://www-1.ibm.com/support/docview.wss?rs=171&q1=mA1J&uid=swg24000673&loc=en_US&cs=utf-8&lang=en 若是Window的版本可以直接使用,若是unix或是linux系列的就請重新編譯了﹝makeFile﹞我有試過在RHEL編譯使用是可以的。 ※請注意一定要在有安裝MQ的Server方可執行喔 使用方式如下: saveqmgr -m xxx -v 53 -o xxx.cfg -m 指定需要匯出的Qmgr名稱 -v 版本 -o 匯出後檔案名稱 以下是相關參數的列表 Usage is: ./saveqmgr. [options], where [options] are one or more of the following optional switches -h | -? : gives help (this) -v version : determines which version of MQSC to generate and can be '2','5','51','52','53' or '6' The default is to generate mqsc at the version of the connected queue manager -m lqmgr : is the name of the local qmgr to connect (MQCONN) -r rqmgr : is the name of the remote qmgr (XMITQ name) -f [file] : allows the output file to be named, if -f is not specified, the outpu...

    Ext-Js Grid + DWR

    Ext-Js中有Grid的sample,想說試試看加上DWR的效果如何?感覺上還不錯,以下是我參考Ext-Js附的grid array sample,加上DWR調整一下的code,我想可能還要加上資料在Loading的效果會比較好。 array-grid.js Ext.onReady(function(){ Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // example of custom renderer function function change(val){ if(val > 0){ return ' ' + val + ' '; }else if(val ' + val + ' '; } return val; } // example of custom renderer function function pctChange(val){ if(val > 0){ return ' ' + val + '% '; }else if(val ' + val + '% '; } return val; } //要設定Dwr傳回的Map的對應格式 var recordType = Ext.data.Record.create( [ {name:"reportid",mapping:"reportid",type:"string"}, {name:"reportName",mapping:"reportName",type:"string"} ] ); var myReader = new Ext.data.JsonReader( { totalProperty:"totalSize", root:"data" },recordType ); // create the data store //這裡是很重要的,這裡還可以加上listener等等的屬性喔 var store = new Ext.da...