IOS
安裝phonegap套件
sudo npm install -g phonegap
建立專案
win8s-Mac:~ leo$ phonegap create my-app
[phonegap] missing library phonegap/www/3.1.0
[phonegap] downloading https://github.com/phonegap/phonegap-app-hello-world/archive/3.1.0.tar.gz...
[phonegap] created project at /Users/leo/my-app
win8s-Mac:~ leo$ cd my-app
win8s-Mac:my-app leo$ phonegap run ios
[phonegap] detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] adding the iOS platform...
[phonegap] missing library cordova/ios/3.1.0
[phonegap] downloading https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;a=snapshot;h=3.1.0;sf=tgz...
[phonegap] compiling iOS...
[phonegap] successfully compiled iOS app
[phonegap] trying to install app onto device
[phonegap] no device was found
[phonegap] trying to install app onto emulator
[warning] missing ios-sim
[warning] install ios-sim from http://github.com/phonegap/ios-sim
[phonegap] successfully installed onto emulator
win8s-Mac:my-app leo$ pwd
/Users/leo/my-app
win8s-Mac:my-app leo$
進入my-app專案,點選helloworld.xcodeproj,即可開啟專案
Android
安裝phonegap
C:\> npm install -g phonegap
jdk,ant要設定好
C:\Users\leo>phonegap create my-app
[phonegap] missing library phonegap/www/3.1.0
[phonegap] downloading https://github.com/phonegap/phonegap-app-hello-world/arch
ive/3.1.0.tar.gz...
[phonegap] created project at C:\Users\leo\my-app
C:\Users\leo>cd my-app
C:\Users\leo\my-app>phonegap local run android
[phonegap] adding the Android platform...
[phonegap] missing library cordova/android/3.1.0
[phonegap] downloading https://git-wip-us.apache.org/repos/asf?p=cordova-android
.git;a=snapshot;h=3.1.0;sf=tgz...
[error] Please install Android target 17 (the Android 4.2 SDK). Make sure you
have the latest Android tools installed as well. Run `android` from your comman
d-line to install/update any missing SDKs or tools.
C:\Users\leo\my-app>android
一定要安裝
Android target 17 (the Android 4.2 SDK),就算電腦有18,還是一定要裝17
C:\Users\leo\my-app>phonegap local run android [phonegap] adding the Android platform... [phonegap] compiling Android... [phonegap] successfully compiled Android app [phonegap] trying to install app onto device [phonegap] successfully installed onto device
就會在platforms資料夾產生android所需資料夾
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。