I am new to android development, but my windows 7 development environment is seemingly set up and working correctly, at least for basic programs. I was planing to use opencv4android in one of my projects so I downloaded and installed both the library and the examples, however I am having trouble getting the sample programs to build correctly.
More precisely the build works ok, but the post compilation processing that occurs when I attempt to run the example from eclipse fails with an error that I do not understand... and after a lot of investigation and experimentation I have completely run out of ideas.
I have tried building using the full Android SDK from google as well as installing the latest version of Eclipse and the ADT plug in separately. But in both cases I get the same results. In both cases I believe I have followed the steps described in your tutorials relating to both setting up the SDK and for the installation of the opencv4android libraries and sample programs.
The (only) sample I am trying to build is the image-manipulations program, which builds without errors, but generates the following error during the post compilation stage:
Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace. OpenCV Sample - image-manipulations Unknown Android Packaging Problem
The verbose logs are as follows:
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Using default Build Tools revision 19.0.0
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Refreshing resource folders.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Using default Build Tools revision 19.0.0
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Starting incremental Pre Compiler: Checking resource changes.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Nothing to pre compile!
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Starting incremental Package build: Checking resource changes.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Using default Build Tools revision 19.0.0
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Skipping over Post Compiler.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Using default Build Tools revision 19.0.0
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Starting full Post Compiler.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx Using Pre-Dexed annotations-321762aea13f26e6df9890c72c86f257.jar <- C:\Users\alun\Code\Sde\android-sdk\tools\support\annotations.jar
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx Using Pre-Dexed opencv library - 2.4.7.1-a57ac1d000d4caf0ca8584abdafd4cd5.jar <- C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\sdk\java\bin\opencv library - 2.4.7.1.jar
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx Input: C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\dexedLibs\annotations-321762aea13f26e6df9890c72c86f257.jar
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx Input: C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\dexedLibs\opencv library - 2.4.7.1-a57ac1d000d4caf0ca8584abdafd4cd5.jar
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx Input: C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx
trouble writing output: already prepared
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing archive C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\dexedLibs\annotations-321762aea13f26e6df9890c72c86f257.jar...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing META-INF/MANIFEST.MF...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing classes.dex...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing archive C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\dexedLibs\opencv library - 2.4.7.1-a57ac1d000d4caf0ca8584abdafd4cd5.jar...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing META-INF/MANIFEST.MF...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing classes.dex...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\R$attr.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\R$id.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\R$styleable.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\R.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\BuildConfig.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\ImageManipulationsActivity$1.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\ImageManipulationsActivity.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$attr.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$drawable.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$id.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$layout.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$string.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R$styleable.class...
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Dx processing C:\Users\alun\Code\Android\Libs\OpenCV-2.4.7.1-android-sdk\samples\image-manipulations\bin\classes\.\org\opencv\samples\imagemanipulations\R.class...
[2013-12-05 21:57:50 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-12-05 21:57:50 - OpenCV Sample - image-manipulations] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
Any suggestions as to what the problem might be would be greatly appreciated.