2014-03-02 37 views
0

我已經爲iOS創建一個PhoneGap的,我想建立在Android系統,但下面的命令不會將其轉換爲Android項目:的PhoneGap:加入Android系統平臺,已建成應用

phonegap platform update android 
phonegap install android 
phonegap build android 

下面是我收到錯誤之一:

[email protected]:~/projects/ecostartup/ecometrix-app$ phonegap platform update android 
[phonegap] updating Android platform... 
    [error] Platform "android" is not installed. 
[email protected]:~/projects/ecostartup/ecometrix-app$ phonegap install android 
[phonegap] detecting Android SDK environment... 
[phonegap] using the local environment 
[phonegap] trying to install app onto device 
[phonegap] no device was found 
[phonegap] trying to install app onto emulator 
    [error] The provided path "/home/lucas/Dropbox/projects/ecostartup/ecometrix-app/platforms/android" is not an Android project. 

下面是另一個錯誤:

[email protected]:~/projects/ecostartup/ecometrix-app$ phonegap build android 
[phonegap] detecting Android SDK environment... 
[phonegap] using the local environment 
[phonegap] adding the Android platform... 
    [error] An error occured during creation of android sub-project. 

/home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126 
        throw e; 
         ^
Error: An error occurred while listing Android targets 
    at /home/lucas/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:87:29 
    at _rejected (/home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24) 
    at /home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30 
    at Promise.when (/home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31) 
    at Promise.promise.promiseDispatch (/home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41) 
    at /home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44 
    at flush (/home/lucas/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17) 
    at process._tickCallback (node.js:415:13) 

[email protected]:~/projects/ecostartup/ecometrix-app$ 

這裏是一些項目信息:

[email protected]:~/projects/ecostartup/ecometrix-app$ ls 
platforms plugins README.md www 
[email protected]:~/projects/ecostartup/ecometrix-app$ ls platforms/ 
ios 

我該如何將其轉換爲Android?

回答

2

實際上看着你的日誌,似乎應用程序已經建成。唯一可見的錯誤是沒有檢測到電話,模擬器無法啓動。

有關命令的使用:

  • phonegap platform update android這個人是當你已經加入Android平臺,以項目和已安裝的PhoneGap的新版本,所以你不需要它的那一刻
  • phonegap install android這裏你試圖將你的應用程序安裝到連接到你的計算機的設備上,並安裝了適當的驅動程序並進行了調試
  • phonegap build android這裏你去了,這是構建android項目和生成調試apk的好命令。

一旦運行構建,你會發現在平臺調試APK /安卓/ bin中

如果你使用一些插件,還檢查它們是否與Android兼容。

+0

我與錯誤更新,以及其他一些項目信息。有什麼建議麼? – modulitos

+0

您是否安裝了Android sdk管理器並下載了Platform for API 19? – QuickFix

0

我仔細檢查了,以確保Android的是我的路徑:

[email protected]:~/projects/ecostartup/ecometrix-app/platforms$ echo $PATH 
(rest of path)...:/opt/android-sdk-linux/sdk/tools:/opt/android-sdk-linux/sdk/platform-tools 

但我需要安裝科爾多瓦:

sudo npm install -g cordova 

,我跑了phonegap build android,這給了我另一個錯誤安裝螞蟻:

sudo apt-get install ant 

這是安裝後全部nodejsnpmphonegap

我發現這個職位非常有幫助:

PhoneGap/Cordova Android Development

(它只是花了一段時間來找到它)運行`的PhoneGap構建android`後