Cordova学习

安装:

sudo npm install -g cordova

需安装npm

brew update

brew uninstall node

brew install node

brew postinstall

sudo npm install -g cordova

创建项目:

cordova create hello com.kaytrip.hello HelloWorld

sudo cordova create hello com.kaytrip.hello HelloWorld

cd hello/

添加iOS平台:

sudo cordova platform add ios

添加Android平台:

sudo cordova platform add android

sudo cordova platform ls

DaqideMac-mini:hello daqihong$ sudo cordova requirements

Password:

Android Studio project detected

Requirements check results for android:

Java JDK: not installed

Failed to find ‘JAVA_HOME’ environment variable. Try setting it manually.

Android SDK: not installed

Failed to find ‘ANDROID_HOME’ environment variable. Try setting it manually.

Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to include path to valid SDK directory.

Android target: not installed

android: Command failed with exit code ENOENT

Gradle: not installed

Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.

Might need to install Android SDK or set up ‘ANDROID_HOME’ env variable.

Requirements check results for ios:

Apple macOS: installed darwin

Xcode: installed 8.3.3

ios-deploy: installed 1.9.4

CocoaPods: not installed

/bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Some of requirements check failed

需要安装Java SDK/ Android SDK/Android Target/Gradle/

npm install -g ios-deploy --unsafe-perm=true