Having Trouble Adding OpenCV to Project

I decided to start learning Android programming by replicating one of the tutorials in the OpenCV SDK.

I created a Visual Studio 2015 project of type “Android Application with Native Code”, from the Nsight Tegra templates added to Visual Studio. Then I copied over the code from the tutorial, making sure the details were appropriately altered. Things like the package= in the Android Manifest, ect.

Unfortunately, I got the error message org.opencv.android does not exist, followed by more for every time OpenCV was used. OpenCV has an odd sdk, with no jar files, so it was hard to search.

I’ve tried every solution I could find on the internet, added the .so and .a files to everywhere in the file system tree in the project, and altered every path in the vcxproj I could. Nothing has worked.

I’ve altered the nsight_tegra_build_overrides, although I didn’t know what I was doing, so no surprise that didn’t work.

I’m sure it’s something simple, but I can’t figure it out. Can anyone help?

Hi Tetragramm,
you can add more java Source Directories:Project Properities>Ant Build>Java> Java Source Directories.
The java wrapper source code for opencv is at \OpenCV-2.4.8.2-Tegra-sdk\sdk\java\src.

victor

Ah, thank you that helps.

Unfortunately, I am now stuck one step further on.

OpenCV has the res/values/attrs.xml, but I can’t seem to get it to be included in the build, which results in “cannot find class R in package org.opencv” errors.

I tried adding the path to sdk/java/res to any place that would take a path. The one that seems correct is the Ant Build>Additional Dependencies>Assets Directories, but it just copies it to the directory. I even tried adding a copy directly to my projects res/values, but that didn’t work either.

Thank you for your help, and I’m sorry for bothering you with beginner questions.