3.0是通过nodejs安装的,不像以前的版本有安装包
到此安装成 设置系统变量 系统变量 Path后面添加:
新增 JAVA_HOME,设置值为java sdk 根目录: C:\Program Files (x86)\Java\jdk1.6.0_10\ 下面就构建应用吧 phonegap create hello com.helloworld.hello helloworld 第一个参数hello表示项目文件夹名,在此文件夹下会生成www子目录作为主页面存入目录,包括有css,js和img资源。 其中config.xml包括了重要的资源描述和项目配置信息. 第2个参数是可选的,com.vmeitime.hello表示项目包名; 第3个参数:HelloWord表示显示的文本; 接下来,添加相应平台 cd hello 进入项目路径 为项目添加插件,然后再生成不同平台下的项目. 添加插件(需要先安装git工具 https://help.github.com/articles/set-up-git): PhoneGap 3.0 最需要关注的是完全的插件体系结构,所有的功能特性包括摄像头等都是使用插件方式提供。也就是说新建项目后很多功能是无法使用的,你必须将其对应的插件添加到项目中。 例如在 cordova 中添加插件的方法是: cordova plugin add https://git-wip-us./repos/asf/cordova-plugin-camera.git 而通过 phonegap 命令行工具的方法是: phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-camera.git 这意味着在开始 PhoneGap 项目时你要先考虑项目需要什么功能,然后通过命令行来添加这些功能。 1). 添加的插件都将放在C:\hello\plugins目录下. 2). 同时会在所有平台下的config.xml文件中增加feature插件配置,如:C:\hello\platforms\<平台>\res\xml\config.xml) 3). 增加相应的插件java文件:C:\hello\platforms\android\src 4). 增加相应的插件js文件:C:\hello\platforms\android\assets\www\plugins 下面是完整的插件列表,我直接拷贝过来,可能会有变化: Basic device information (Device API): $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-device.git Network Connection and Battery Events: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-network-information.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-battery-status.git Accelerometer, Compass, and Geolocation: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-device-motion.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-device-orientation.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-geolocation.git Camera, Media playback and Capture: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-camera.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-media-capture.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-media.git Access files on device or network (File API): $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-file.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-file-transfer.git Notification via dialog box or vibration: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-dialogs.git $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-vibration.git Contacts: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-contacts.git Globalization: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-globalization.git Splashscreen: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-splashscreen.git Open new browser windows (InAppBrowser): $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-inappbrowser.git Debug console: $ phonegap local plugin add https://git-wip-us./repos/asf/cordova-plugin-console.git 运行build命令,输入不同平台标识,生成不同平台下的相应文件。如下以android设备为例: c:\hello> phonegap build android 要查看详细(verbose)执行过程,可增加命令参数-V : c:\hello> phonegap -V build android 之后可以看到C:\hello\platforms\android里出现Android项目。 下面你就导入进eclipse 编辑吧 是不是比以前创建应用方便多了 如果遇到java问题,可能你要换到jdk1.6 |
|