phonegap 2.9.01.3.0存在哪些问题

两天热门文章
最新推荐文章Android移动APP开发笔记——最新版Cordova 5.3.1(PhoneGap)搭建开发环境 - 风尘浪子 - 博客园
只要肯努力,梦想总有一天会实现&&
简单介绍一下Cordova的来历,Cordova的前身叫PhoneGap,自被Adobe收购后交由Apache管理,并将其核心功能开源改名为Cordova。它能让你使用HTML5轻松调用本地API接口和发布应用到商店的应用开发平台。有低成本,低开发周期,轻量化等优点。它统一封装了Andriod,IOS,WindowsPhone,Symbian等几大移动开发平台的API,采用HTML5+JavaScript的混合开发的模式来开发智能移动的APP,解决系统兼容等问题。使用Cordova把APP从一个平台移植到另外一个平台只需要把HTML代码跟JS打包一下就可以了,减少了大量的开发成本与开发时间,因此受到广大企业与开发人员的青睐。现在不少的大型网站(例如京东,淘宝等)手机APP都是使用此种混搭模式进行开发。
详细说明可看Cordova的官方网站
一、软件包下载
运行环境:Windows 7
JDK 7 下载:
Android SDK 下载:
ADT-23.0.6下载:
Node-v4.1下载:
Ant-1.9.6下载:
二、JDK安装部署
JDK (Java Development Kit) 是 Sun 针对Java开发员的产品,是现今使用最广泛的Java SDK。JDK 是整个Java的核心,包括了Java运行环境和基础类库等。常用版本包括 JDK 6、JDK 7、JDK 8。
成功安装 JDK&7 后,必须设置环境变量,让系统感知并能调用 JDK 7。
打开 &控制面板 --& 系统安全 --& 系统 --& 高级系统设置 --& 环境变量&,增加以下配置 :
C:\ jdk7.win32.x86_64_1.7.0.u45
写入JDK安装的路径
;%java_home%\bin
在Path原有值上加入此值
;%java_home%\lib\dt.%java_home%\lib\tools.jar
在classpath的原有值上加入此值
三、Android SDK 安装部署
如果通过Eclipse来开发Andorid应用程序,配置好了JDK变量环境之后可以安装Eclipse,然后下载Android SDK(Software Development Kit)并在Eclipse中安装ADT插件,这个插件能让Eclipse和Android SDK关联起来。
3.1 ADT安装
ADT 全名 Android Development Tools, 使用Eclipse开发Android,在Eclipse编译IDE环境中安装ADT,可以为Android开发提供开发工具的升级或者变更,方便Android SDK等版本的管理。当然,如果使用Android&Studio等开发工具,ADT可无需安装。
由于中国的特殊情况,防护墙把Google官网给封了,所以在Eclipse Marketplace中直接下载ADT,将出现类似 &Unable to connect to repository && 等错误。此时除了使用代理外,修改hosts等方法外,还可使用以下方法进行安装。首先在 &下载ADT-23.0.6.zip包,打开菜单Help-InstallForSite
直接选择已下载的ADT-23.0.6.zip包
安装完成后,你可以看到新建项目时出现Android选项
3.2 部署环境变量
把下载的Android SDK解压后,新建系统变量,操作类似于JDK1.7系统变量设置。选择&系统变量&中变量名为&Path&的环境变量,变量后追加&&;D:\MyEclipse Professional 2014\android-sdk-windows\D:\MyEclipse Professional 2014\android-sdk-windows\tools\platform-&
3.3 安装Android SDK
官网上下载Android SDK后,直接打开SDK Manager
由于中国的特殊情况,防护墙把google官网给封了,所以下载前须打开菜单Tools-Options设置代理,否则会出现 &Fetching https://dl-/android/repository/addons_list-2.xml& 等错误
HTTP Proxy Server设置为:android-mirror.& HTTP Proxy Port设置为:8080也可参考网站
选择所需要的Android版本进行下载,如果下载版本多所占用的空间可能比较大,用的时间也比较长。个人下载了Android 5.1、Android 4.4、Android4.1.2等几个版本,需要大约20G左右。
3.4 绑定Android SDK
打开菜单 windows-preferences ,选择Android项目,把SDK Location绑定到 Android SDK 所在的文件夹,可看到刚刚所下载的各个Android SDK 版本
四、Cordova/PhoneGap 安装部署
在官网下载最新版 Node-v4.1,完成安装后,在环境变量中把path增加配置 & ;C:\Program Files\nodejs\;& 为了方便管理,建议为Eclipse加入Ant插件。在Ant 官网下载 Ant-1.9.6,完成安装后在环境变量中把path增加配置 &;D:\MyEclipse Professional 2014\apache-ant-1.9.6\bin& 。此时,在命令提示符窗口执行以下命令 npm install -g cordova 等待三五分钟,完成cordova安装后,系统就会出现以下提示:
注意:Cordova 对 Android SDK 的版本是有要求的,如果需要控制所安装的版本,可使用命令
npm install -g cordova@****& (版本号)
五、建立Cordova 测试项目
5.1 建立Android工程基础文件
输入命令 &cordova create AndroidFiles com.sun.androidapp AndroidTest& ,建立工程文件。其中AndroidFiles是文件夹名称,com.sun.androidapp是包名称,AndroidTest是工程名称
5.2创建工程实例
进入刚创建的文件AndroidFiles, 输入命令 cordova platform add android 建立工程实例
除此以外,还可以用以类似命令创建 iOS、WP、BlackBerrry 等平台的实例
cordova platform add ios
cordova platform add wp7
cordova platform add wp8
cordova platform add blackberry10
同时,也可使用以下命令控制所生成实例的 Android SDK 运行环境
cordova platform add android@****&&(版本号)
此时,再输入命令 cordova&build ,当出现BUILD SUCCESSFUL等字样后,代表项目已成功生成
&此时可以用几种简单的方式对项目进行测试
浏览器测试
输入命令cordova serve android, 在浏览器中打开相关地址 http://localhost:8000
连接手机,选择调试选项,输入命令cordova run android
&模拟器测试
输入命令cordova emulate android
5.4项目编辑配置
打开Eclipse,导入刚创建的工程,工程中包含两个项目,一个是CordovaLib,一个是MainActivity。MainActivity为测试项目,CordovaLib 为Cordova 的源代码项目。 首先选择项目属性,设置Android所运行的基础平台。
注意:Cordova 5.3.1 中 CordovaLib 要求运行在 Android SDK 5.1.1, API Level 22或以上,否则某些API将报错,MainActivity 运行的平台版本则可以按需要而设。
另外,JDK 1.7要求Android SDK 版本为API Level 17或以上,若选择运行16或者以下运行环境,系统将会出现以下错误。此时可设置项目属性,把运行环境设计为JDK 1.6 以解决问题。
一般在Eclipse使用Android Virtual Device (AVD) 虚拟器进行项目测试,在运行测试前,先配置运行环境。选择Target-&Manager
按下Create键,配置一台Android虚拟器,用户可根据实际情况配置多台Android虚拟机。
完成配置后,选择Start,启动Android虚拟器
启动调试后,选择你所配置的虚拟机即可运行,在此Cordova的环境部署已经大功告成了,你可以在Eclipse中使用HTML5+Javascript方式完成Android开发了。
使用Cordova/PhoneGap,应用程序的构建可以无需本地代码,直接使用的是Web技术即可。由于这些API在多个设备平台上是一致的,都是基于HTML5 Web标准创建,因此应用程序的移植很方便。Cordova支持iOS、Android、Blackberry、Windows Phone、Palm WebOS、Bada和Symbian等多个平台,只需要使用平台SDK打包成应用程序,可以从每种设备的应用程序商店下载安装。因此,Cordova将成为未来手机混合开发的新趋势。
Android开发笔记
作者:风尘浪子
原创作品,转载时请注明作者及出处
评论 - 930Reap the benefits of open source From the team behind , the Adobe PhoneGap framework is an open source distribution of Cordova — providing the advantage of technology created by a diverse team of pros along with a robust developer community — plus access to the PhoneGap toolset, so you can get to mobile faster.
See what’s possible with PhoneGap
Featured apps from ourMobile apps with HTML, CSS & JS
Target multiple platforms with one code base
Free and open source
Reusable code across platforms
Support for offline scenarios
Access native device APIs
Get Started Fast
Installing Cordova
Cordova command-line runs on
and is available on
to install additional platform dependencies. Open a command prompt or Terminal, and type npm install -g cordova.
$ npm install -g cordova
npm install -g cordova
Create a project
Create a blank Cordova project using the command-line tool.
Navigate to the directory where you wish to create your project and type cordova create &path&.
For a complete set of options, type cordova help create.
$ cordova create MyApp
cordova create MyApp
Add a platform
After creating a Cordova project, navigate to the project directory.
From the project directory, you need to add a platform for which you want to build your app.
To add a platform, type cordova platform add &platform name&.
For a complete list of platforms you can add, run cordova platform.
$ cd MyApp
$ cordova platform add browser
cd MyApp
cordova platform add browser
Run your app
From the command line, run cordova run &platform name&.
$ cordova run browser
cordova run browser
Common next steps
Supported Platforms
See a list of
in each platform
Cordova wraps your HTML/JavaScript app into a native container which can access the device functions of several platforms.
These functions are exposed via a unified JavaScript API, allowing you to easily write one set of code to target nearly every
phone or tablet on the market today and publish to their app stores.
Cordova Tools
A diverse ecosystem of command line tools, JavaScript frameworks, and cloud services exist that augment Cordova
PhoneGap is the original and most popular distribution of Apache Cordova. Turn your HTML, CSS and JavaScript into an app on your device in minutes using our simple
desktop and
developer apps.
Ionic is a front-end SDK for building cross-platform mobile apps. Built on top of Angular, Ionic also provides a platform for integrating services like push notifications and analytics.
Comprehensive cloud-powered and framework-agnostic set of tools Monaca supports both online and offline development, debugging with live-reload feature and cloud build experience.
Custom Elements-based HTML5 framework offers a large selection of components and responsive layout support. Onsen UI lets you create professionally designed multiplatform apps without acquiring additional skillset.
Popular IDE for building cross-platform apps for Android, iOS, and Windows. Complete with advanced build and debugging support.
Tools for Apache Cordova is a command line utility designed to make building hybrid apps easy and fun.
Faster setup. Friendlier command line. Validated quality at run-time.
Telerik Platform is a complete mobile app development platform for developing hybrid and native apps with JavaScript. Use our free and open source Kendo UI framework with Telerik Platform to address every stage of your application lifecycle - from idea...
GapDebug is a free tool for debugging and managing hybrid-mobile Android and iOS apps. With Drag and drop App Installation, Instant debugging, and full cross-platform support, GapDebug changes how you view debugging for good.
App Builder is a complete IDE for Microsoft Windows which allows to create HTML5 and native apps without programming knowledge. Offers dozens of controls and actions ready to be used in your apps and lot of app samples to learn it.
HTML5 IDE with Cordova-specific tools for project configuration, plugin management, integrated emulation and debugging, on-device preview and live reload, cloud-based build and more.
Cocoon is a Cordova based cloud service for building native HTML5 apps and games. Cocoon is focused on providing the best webview engines and features like Canvas+, JS encryption or a custom Developer App.
Framework7 is a free and open source mobile HTML framework for developing hybrid mobile apps or web apps with iOS & Android native look and feel.
Evothings Studio provides Cordova developers with a rapid development workflow, tutorials and example apps for the Internet of Things. Support for Bluetooth Low Energy (BLE) and other IoT related technologies.
Cordova App Showcase
See other apps that use Cordova
Daily tools for stress, anxiety and depression based on Cognitive Behavioral Therapy and Mindfulness.
Sworkit delivers on-demand, personalized video exercises to millions of users to help them stay fit.
Sports only social app for fans to share their experiences.
JustWatch is the easiest way to see if your favorite movies or TV shows are available on any streaming provider.
Gudog brings together dog owners and trustworthy dog sitters who offer Home Dog Boarding, Dog Walking and Doggy Daycare.
Series Seven allows you to track your favorite TV shows and easily get all information about TV show. You'll never miss new e...
Get a Handyman or Plumber to your House in 1 Hour. Keepe delivers the right contractor at your doorstep.
Clever Baby is the easiest way to track your baby's well-being, growth and development.
You are using PhoneGap Build to develop your Apps? Then Buildr will be your new best friend. Rebuild, pull and monitor your a...
ReactEurope is the occasion to meet the core team and other awesome members of the community to learn, socialize and have fun...
The easiest and prettiest way to check your grades from Home Access Center (HAC)
One Verse BIBLE is a beautifully crafted Bible app to focus more on each Bible Verse and to compare easily with various Bible...
More Resources
Development
Apache Software Foundation
Contribute
Help Cordova move forward!
Report bugs, improve the docs, or contribute to the code.}

我要回帖

更多关于 phonegap 2.9.0 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信