phonegap環境搭建

你們仍是要借鑑官網給的說明,附上連接地址:
html

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


安裝所須要的JDK、ANT、android sdk我就不說什麼了。。你們都本身按吧。。這裏要注意android sdk這個東東的版本,後續再來解釋。android


下載個nodejs,這個玩意特別無語對它,你用npm install -g cardova下載這個東西nodejs v0.12.x以後版本均無效,下載失敗,須要更改nodejs v0.10.0這個傻逼玩意,可是這裏其實不用換換了浪費時間後續還得出錯,而後你使用它後續進行的配置都是最新的,你繼續用cordove platform add android 而後 cordova build 就會報錯web

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

我就去他大爺的。。這個意思是你要安裝android-22的sdk包。。。個人android4.4版本的是android-19,我翻遍百度貌似仍是下載不到android-22的。糾結。apache

各位能夠用android list target去查看你的target。npm

我一直糾結這玩意是特麼傻逼麼。。app

因此下載完nodejs後上述那些操做均不作,下面纔是關鍵步驟less

以後ide

而後我下載了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/)

相關文章
相關標籤/搜索