[关闭]
@2890594972 2017-10-29T11:16:58.000000Z 字数 1162 阅读 996

Create your first Cordova app

cordova 大象


Step1.Installing Cordova CLI

  1. npm install -g cordova

Step2.Create the App

  1. cordova create hello com.example.hello HelloWorld
  2. cordova create demo com.dxample.demo demo

注意:
1.cordova目前打包的是SPA(单页面应用程序)
2.www/index.html 入口文件
3.config.xml配置文件

Step3.Add Platforms

  1. cd hello
  2. cordova platform add ios
  3. cordova platform add android
  4. cordova platform ls

Step4.Install pre-requisites for building

  1. $ cordova requirements
  2. Requirements check results for android:
  3. Java JDK: installed .
  4. Android SDK: installed
  5. Android target: installed android-19,android-21,android-22,android-23,Google Inc.:Google APIs:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:23
  6. Gradle: installed
  7. Requirements check results for ios:
  8. Apple OS X: not installed
  9. Cordova tooling for iOS requires Apple OS X
  10. Error: Some of requirements check failed

Step5.Build the App

  1. cordova build //build android和ios
  2. cordova build android //build android
  3. cordova build ios //build ios

Step6.Test the App

  1. cordova emulate android

打开android模拟器
打开应用程序效果

Step7.Add Plugins

  1. cordova plugin add cordova-plugin-camera //添加照相机插件
  2. cordova plugin search camera //搜索插件
  3. cordova plugin ls //查看安装的插件

报错

cordova build android报错

解决方法1:尝试失败
在android studio下载
[Android SDK Platform 26]
解决方法2:通过SDK Manager安装26
测试成功
qiangchanggong.png-206.2kB

从:w3cschool去看
http://blog.csdn.net/yushuyou/article/details/50751506

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注