build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
Following the tutorial at: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html
*edit* new tutorial is OpenCV 2.4.2 for Android and the updated tutorial in answer below. As per recommendation, a summary of the problems*
Summary of problems building android_binary_package with Eclipse on Ubuntu
- Errors following the steps for JDK installation
- Errors attempting to build from commandline with Ant and build.xml.
- project.properties errors for all sample projects. There is a script in /samples/android/fix_properties.sh . It seems it is missing a #!/bin/bash and, for me, errors of Command not found android: occur. I needed to give a full path to the android executable in adnroid-sdk-linux/tools/ . I just discovered the script, it's not mentioned in the tutorial.
- Not sure how to link OpenCV-2.4.0 Library into Eclipse. Which folder should i reference? One containing .jar or AndroidManifest.xml?
[my comments in []s ]
1 Sun JDK 6 [First of all, I'm surprised if only the Sun JDK works that it isn't mentioned in https://developer.android.com/tools/sdk/eclipse-adt.html]
Dependencies: Java 1.6 or higher is required for ADT 20.0.0.
[In fact, i have been using Eclipse Indigo to develop android for a few projects and output from errors in the console say I'm running ]
java.version=1.6.0_24 java.vendor=Sun Microsystems Inc.
but in a terminal shell $ java -version gives
java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
[Following the instructions, i run into problems.]
Visit http://www.oracle.com/technetwork/java/javase/downloads/index.html and download installer for your OS.
[requires a long login, must sudo chmod +x the downloaded file, i get errors when i run the file of dependencies not found like /bin/sh but of course they are there. Exits with Done, but i don't know if it was successful or where it unpacked the files to. No easy checkpoint. Command-line output follows]
rpm: RPM should not be used directly install RPM packages, use Alien instead! rpm: However assuming you know what you are doing... many errors ending with... error: Failed dependencies: /bin/sh is needed by sun-javadb-core-10.6.2-1.1.i386 Done.
[Continuing on with the tutorial]
Here is a detailed installation guide for Ubuntu and Mac OS: http://source.android.com/source/initializing.html#installing-the-jdk (only JDK sections are applicable for OpenCV)
[following their instructions I get problems]
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" $ sudo apt-get update $ sudo apt-get install sun-java6-jdk Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'sun-java6-jdk' has no installation candidate
Note OpenJDK is not usable for Android development because Android SDK supports only Sun JDK. If you use Ubuntu, after installation of Sun JDK you should ...
Ok, you posted a long detailed description of your problem, maybe it would help if in the beginning of the post you write the short version clearly stating: problem, question.