This guide was designed to help you in learning Android development basics and quickly seting up your working environment.
-This guide was written with Windows 7 in mind, though it should work with any other OS supported by Android SDK.
+This guide was written with Windows 7 in mind, though it works with Linux (Ubuntu), Mac OS X and any other OS supported by Android SDK.
If you encounter any error after thoroughly following these steps, feel free to contact us via `OpenCV4Android <https://groups.google.com/group/android-opencv/>`_ discussion group or OpenCV `Q&A forum <http://answers.opencv.org>`_ . We'll do our best to help you out.
where:
-* the :file:`src` folder contains Java code of the application
+* the :file:`src` folder contains Java code of the application,
* the :file:`res` folder contains resources of the application (images, xml files describing UI layout , etc),
* the :file:`libs` folder will contain native libraries after a successful build,
* and the :file:`jni` folder contains C/C++ application source code and NDK's build scripts :file:`Android.mk` and :file:`Application.mk`
- producing the native libraries.
+ producing the native libraries,
* :file:`AndroidManifest.xml` file presents essential information about application to the Android system
(name of the Application, name of main application's package, components of the application, required permissions, etc).
This file is generated by Eclipse or can be created with :command:`android` tool included in Android SDK.
.. note:: Both files (:file:`AndroidManifest.xml` and :file:`project.properties`) are required to compile the C++ part of the application,
- since NDK build system relies on them. If any of these files does not exist, compile the Java part of the project before the C++ part.
+ since Android NDK build system relies on them. If any of these files does not exist, compile the Java part of the project before the C++ part.
:file:`Android.mk` and :file:`Application.mk` scripts
==================================================================
Quick environment setup for Android development
===============================================
-If you are making a clean environment install, then you can try `Tegra Android Development Pack <http://developer.nvidia.com/tegra-android-development-pack>`_
+If you are making a clean environment install, then you can try `Tegra Android Development Pack <http://developer.nvidia.com/mobile/tegra-android-development-pack>`_
(**TADP**) released by **NVIDIA**.
When unpacked, TADP will cover all of the environment setup automatically and you can skip the rest of the guide.
.. |Nvidia_Tegra_Platform| replace:: *NVIDIA*\ ’s Tegra platform
.. _Nvidia_Tegra_Platform: http://developer.nvidia.com/node/19071
.. |Tegra_Development_Kit| replace:: Tegra Development Kit
-.. _Tegra_Development_Kit: http://developer.nvidia.com/tegra-ventana-development-kit
+.. _Tegra_Development_Kit: http://developer.nvidia.com/mobile/tegra-hardware-sales-inquiries
.. _Android_Environment_Setup_Lite:
sudo update-java-alternatives --set java-6-sun
**TODO:** add a note on Sun/Oracle Java installation on Ubuntu 12.
-
+
#. **Android SDK**
Get the latest ``Android SDK`` from http://developer.android.com/sdk/index.html
:alt: Android SDK Manager
:align: center
- See `Adding SDK Components <http://developer.android.com/sdk/adding-components.html>`_ for help with installing/updating SDK components.
+ See `Adding Platforms and Packages <http://developer.android.com/sdk/installing/adding-packages.html>`_ for help with installing/updating SDK components.
#. **Eclipse IDE**
#. **ADT plugin for Eclipse**
- These instructions are copied from `Android Developers site <http://developer.android.com/sdk/eclipse-adt.html#downloading>`_, check it out in case of any ADT-related problem.
+ These instructions are copied from `Android Developers site <http://developer.android.com/sdk/installing/installing-adt.html>`_, check it out in case of any ADT-related problem.
Assuming that you have Eclipse IDE installed, as described above, follow these steps to download and install the ADT plugin:
#. **Android NDK**
-To compile C++ code for Android platform you need ``Android Native Development Kit`` (*NDK*).
+ To compile C++ code for Android platform you need ``Android Native Development Kit`` (*NDK*).
+
+ You can get the latest version of NDK from the `download page <http://developer.android.com/tools/sdk/ndk/index.html>`_. To install Android NDK just extract the archive to some folder on your computer. Here are `installation instructions <http://developer.android.com/tools/sdk/ndk/index.html#Installing>`_.
-You can get the latest version of NDK from the `download page <http://developer.android.com/sdk/ndk/index.html>`_. To install Android NDK just extract the archive to some folder on your computer. Here are `installation instructions <http://developer.android.com/sdk/ndk/index.html#installing>`_.
+ .. note:: Before start you can read official Android NDK documentation which is in the Android NDK archive, in the folder :file:`docs/`.
-.. note:: Before start you can read official Android NDK documentation which is in the Android NDK archive, in the folder :file:`docs/`.
+ The main article about using Android NDK build system is in the :file:`ANDROID-MK.html` file.
- The main article about using Android NDK build system is in the :file:`ANDROID-MK.html` file.
+ Some additional information you can find in the :file:`APPLICATION-MK.html`, :file:`NDK-BUILD.html` files, and :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`, :file:`PREBUILTS.html`.
- Some additional information you can find in the :file:`APPLICATION-MK.html`, :file:`NDK-BUILD.html` files, and :file:`CPU-ARM-NEON.html`, :file:`CPLUSPLUS-SUPPORT.html`, :file:`PREBUILTS.html`.
-
#. **CDT plugin for Eclipse**
-There are several possible ways to integrate compilation of C++ code by Android NDK into Eclipse compilation process.
-We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling)` Builder.
+ There are several possible ways to integrate compilation of C++ code by Android NDK into Eclipse compilation process.
+ We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling)` Builder.
-.. important:: Make sure your Eclipse IDE has the :abbr:`CDT(C/C++ Development Tooling)` plugin installed. Menu :guilabel:`Help -> About Eclipse SDK` and push :guilabel:`Installation Details` button.
+ .. important:: Make sure your Eclipse IDE has the :abbr:`CDT(C/C++ Development Tooling)` plugin installed. Menu :guilabel:`Help -> About Eclipse SDK` and push :guilabel:`Installation Details` button.
-.. image:: images/eclipse_inst_details.png
- :alt: Configure builders
- :align: center
+ .. image:: images/eclipse_inst_details.png
+ :alt: Configure builders
+ :align: center
-To install the `CDT plugin <http://eclipse.org/cdt/>`_ use menu :guilabel:`Help -> Install New Software...`,
-then paste the CDT 8.0 repository URL http://download.eclipse.org/tools/cdt/releases/indigo as shown in the picture below and click :guilabel:`Add...`, name it *CDT* and click :guilabel:`OK`.
+ To install the `CDT plugin <http://eclipse.org/cdt/>`_ use menu :guilabel:`Help -> Install New Software...`,
+ then paste the CDT 8.0 repository URL http://download.eclipse.org/tools/cdt/releases/indigo as shown in the picture below and click :guilabel:`Add...`, name it *CDT* and click :guilabel:`OK`.
-.. image:: images/eclipse_inst_cdt.png
- :alt: Configure builders
- :align: center
+ .. image:: images/eclipse_inst_cdt.png
+ :alt: Configure builders
+ :align: center
-``CDT Main Features`` should be enough:
+ ``CDT Main Features`` should be enough:
-.. image:: images/eclipse_inst_cdt_2.png
- :alt: Configure builders
- :align: center
+ .. image:: images/eclipse_inst_cdt_2.png
+ :alt: Configure builders
+ :align: center
-That's it. Compilation of C++ code is fully integrated into Eclipse building process now.
+ That's it. Compilation of C++ code is fully integrated into Eclipse building process now.
Debugging and Testing
=====================
;NVIDIA Tegra
%SingleAdbInterface% = USB_Install, USB\VID_0955&PID_7100&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_0955&PID_7100&REV_9999&MI_01
-
+
#. Assuming you have your SDK installed to :file:`C:/android-sdk/`, you may try the following command in Windows console to acertain that your device was recognised and attached:
.. code-block:: ini
C:\android-sdk\platform-tools\adb devices
-
+
.. image:: images/cmd_adb_devices.png
:alt: Console
:align: center
-
+
#. Now, in Eclipse go :guilabel:`Run -> Run/Debug` to run your application in regular or debugging mode. :guilabel:`Device Chooser` will let you choose among the devices.
Consult the official `Android Developers site <http://developer.android.com/tools/device.html>`_ for more information on configuring hardware devices to work with other operating systems.
+**TODO:** Describe device setup on Linux & OSX.
+
What's next
===========
-
+
Now, when you have your development environment set up and configured, you may want to proceed to installing OpenCV4Android SDK. You can learn how to do that in a separate :ref:`O4A_SDK` tutorial.
\ No newline at end of file