Ask Your Question
0

Unable to Build image-manipulations Sample for Android

asked 2013-12-05 21:17:09 -0600

updated 2018-12-06 12:47:46 -0600

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 ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-12-05 21:35:47 -0600

I just tried answering my own question, but apparently I can't do that as I am a new user :) So a comment is has to be :)

Immediately after posting this question I found this link:

http://answers.opencv.org/question/76...

Which suggested I could change the target API. I had already noted that the library and sample had target APIs of 11 and 14 but I had downloaded those APIs to solve the problem. After experiences with another project I had assumed they were set that way for a good reason....

However as it turns out when both set to use a target API version of 19 there was no problem and my error went away....

So the problem is solved, the target APIs needed to be the same.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-12-05 21:17:09 -0600

Seen: 846 times

Last updated: Dec 05 '13