cordova-android/README.md

126 lines
3.8 KiB
Markdown
Raw Normal View History

<!--
#
# 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
2011-08-18 18:21:51 -07:00
===
2013-01-23 12:17:42 -08:00
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.
2013-02-15 13:12:19 -08:00
[Apache Cordova](http://cordova.io) is a project at The Apache Software Foundation (ASF).
2009-11-24 15:11:32 -08:00
2013-01-23 18:31:30 -08:00
2011-08-19 22:20:53 -07:00
Requires
2011-08-18 18:21:51 -07:00
---
- Java JDK 1.5 or greater
- Apache ANT 1.8.0 or greater
2011-08-19 22:20:53 -07:00
- Android SDK [http://developer.android.com](http://developer.android.com)
- Apache Commons Codec [http://commons.apache.org/codec/](http://commons.apache.org/codec/)
2012-01-17 16:31:08 -05:00
Cordova Android Developer Tools
2011-08-18 18:21:51 -07:00
---
The Cordova developer tooling is split between general tooling and project level tooling.
2011-09-01 14:44:02 -07:00
2012-05-07 12:31:24 -07:00
To enable the command-line tools available in the ./bin directory, make
sure you have all of the dependencies installed. You will need
[NodeJS](http://nodejs.org) (which should come with `npm`). To install
the dependencies:
$ cd bin
$ npm install
2011-10-31 21:14:05 -05:00
General Commands
2010-08-30 16:02:47 -07:00
./bin/create [path package activity] ... create the ./example app or a cordova android project
2011-09-01 14:44:02 -07:00
./bin/bench ............................ generate a bench proj
./bin/autotest ......................... test the cli tools
2011-08-18 18:31:13 -07:00
./bin/test ............................. run mobile-spec
2011-09-01 14:44:02 -07:00
Project Commands
These commands live in a generated Cordova Android project.
2011-09-01 14:44:02 -07:00
2012-09-10 15:05:57 -04:00
./cordova/debug [path] ..................... install to first device
2012-02-01 20:45:49 -05:00
./cordova/emulate .......................... start avd (emulator) named default
./cordova/log .............................. starts logcat
2011-08-18 18:31:13 -07:00
Running the Example Project
2011-08-19 22:20:53 -07:00
---
Start avd (emulator) named `default`:
2011-08-18 18:31:13 -07:00
2011-08-18 18:21:51 -07:00
./bin/emulate
2010-08-30 16:02:47 -07:00
2011-10-31 21:14:05 -05:00
Create the example project and build it to the first device:
2011-08-19 22:20:53 -07:00
./bin/create
2011-09-01 14:44:02 -07:00
cd example
2012-02-01 20:45:49 -05:00
./cordova/debug
2011-08-19 22:20:53 -07:00
Start adb logcat (console.log calls output here):
2011-08-18 18:31:13 -07:00
2012-02-01 20:45:49 -05:00
./cordova/log
2009-12-22 16:01:54 -08:00
Creating a new Cordova Android Project
2011-10-31 21:14:05 -05:00
---
./bin/create ~/Desktop/myapp com.myapp.special MyApp
Importing a Cordova Android Project into Eclipse
2011-08-19 22:20:53 -07:00
----
1. File > New > Project...
2. Android > Android Project
2010-08-30 16:02:47 -07:00
3. Create project from existing source (point to the generated app found in tmp/android)
2012-02-01 20:45:49 -05:00
4. Right click on libs/cordova.jar and add to build path
5. Right click on the project root: Run as > Run Configurations
2010-08-30 16:02:47 -07:00
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
2013-05-21 15:23:36 -07:00
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, copy the commons codec:
mv commons-codec-1.7.jar framework/libs
then run in the framework directory:
android update project -p . -t android-17
ant jar
2012-05-16 16:13:46 -07:00
Running Tests
----
2012-05-31 16:01:20 -07:00
Please see details under test/README.md.
2010-08-30 16:02:47 -07:00
2011-08-19 22:20:53 -07:00
Further Reading
2010-08-30 16:02:47 -07:00
---
2011-08-19 22:20:53 -07:00
- [http://developer.android.com](http://developer.android.com)
2013-05-21 15:23:36 -07:00
- [http://cordova.apache.org/](http://cordova.apache.org)
- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/)