首页 > 其他 > 详细

phonegap环境搭建

时间:2015-04-28 00:24:58      阅读:342      评论:0      收藏:0      [点我收藏+]

大家还是要借鉴官网给的说明,附上链接地址:

http://docs.phonegap.com/en/edge/guide_platforms_android_index.md.html#Android%20Platform%20Guide


安装所需要的JDK、ANT、android sdk我就不说什么了。。大家都自己按吧。。这里要注意android sdk这个东东的版本,后续再来解释。


下载个nodejs,这个玩意特别无语对它,你用npm install -g cardova下载这个东西nodejs v0.12.x之后版本均无效,下载失败,需要更改nodejs v0.10.0这个傻逼玩意,但是这里其实不用换换了浪费时间后续还得出错,然后你使用它后续进行的配置都是最新的,你继续用cordove platform add android 然后 cordova build 就会报错

error:please install android target: "android-22".

我就去他大爷的。。这个意思是你要安装android-22的sdk包。。。我的android4.4版本的是android-19,我翻遍百度貌似还是下载不到android-22的。纠结。

各位可以用android list target去查看你的target。

我一直纠结这玩意是特么傻逼么。。

所以下载完nodejs后上述那些操作均不做,下面才是关键步骤

之后

然后我下载了cordova-3.4.0-src.zip 下载地址:http://archive.apache.org/dist/cordova/

特别注意下载的cordova-x.x.x-src版本跟你的android sdk是挂钩的

android4.4 sdk 对应下载cordova-3.4.0

如何你是其他的sdk包。。慢慢试吧。。

重点来了如何使用cordova-3.4.0-src.zip包,,解压后打开并解压cordova-android.zip,

技术分享

里面有个bin文件夹,里面有个create.bat。。。

我突然想起来cordova create xxx xxx xxx操作来。。其实你用里面的create.bat xxx xxx xxx即可创建新的工程

技术分享

这个大家再不明白我就木有办法了。。创建完后。然后推荐大家去看上述图中的README.md真理就在里面。。我把粘贴出来了。。你们在看不懂就私聊吧

<!--

#

# Licensed to the Apache Software Foundation (ASF) under one

# or more contributor license agreements.  See the NOTICE file

# distributed with this work for additional information

# regarding copyright ownership.  The ASF licenses this file

# to you under the Apache License, Version 2.0 (the

# "License"); you may not use this file except in compliance

# with the License.  You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing,

# software distributed under the License is distributed on an

# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

#  KIND, either express or implied.  See the License for the

# specific language governing permissions and limitations

# under the License.

#

-->

Cordova Android

===


Cordova Android is an Android application library that allows for Cordova-based

projects to be built for the Android Platform. Cordova based applications are,

at the core, applications written with web technology: HTML, CSS and JavaScript. 


[Apache Cordova](http://cordova.io) is a project at The Apache Software Foundation (ASF).



Requires

---


- Java JDK 1.5 or greater

- Apache ANT 1.8.0 or greater

- Android SDK [http://developer.android.com](http://developer.android.com)


 

Cordova Android Developer Tools

---


The Cordova developer tooling is split between general tooling and project level tooling. 


General Commands


    ./bin/create [path package activity] ... create the ./example app or a cordova android project

    ./bin/check_reqs ....................... checks that your environment is set up for cordova-android development

    ./bin/update [path] .................... updates an existing cordova-android project to the version of the framework


Project Commands


These commands live in a generated Cordova Android project. Any interactions with the emulator require you to have an AVD defined.


    ./cordova/clean ........................ cleans the project

    ./cordova/build ........................ calls `clean` then compiles the project

    ./cordova/log   ........................ stream device or emulate logs to stdout

    ./cordova/run   ........................ calls `build` then deploys to a connected Android device. If no Android device is detected, will launch an emulator and deploy to it.

    ./cordova/version ...................... returns the cordova-android version of the current project


Importing a Cordova Android Project into Eclipse

----


1. File > New > Project...

2. Android > Android Project

3. Create project from existing source (point to the generated app found in tmp/android)

4. Right click on libs/cordova.jar and add to build path

5. Right click on the project root: Run as > Run Configurations

6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)


Building without the Tooling

---

Note: The Developer Tools handle this.  This is only to be done if the tooling fails, or if 

you are developing directly against the framework.



To create your `cordova.jar` file, run in the framework directory:


    android update project -p . -t android-17

    ant jar



Running Tests

----

Please see details under test/README.md.


Further Reading

---


- [http://developer.android.com](http://developer.android.com)

- [http://cordova.apache.org/](http://cordova.apache.org)

- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/)




phonegap环境搭建

原文:http://my.oschina.net/u/163029/blog/407014

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!