I'm having some trouble adding OpenCV to a new Android project

后端 未结 3 1294
一个人的身影
一个人的身影 2021-01-05 07:28

I have made modifications to several example OpenCV projects within Android, however I am having some issues with using OpenCV successfully in a new Android project.

<
相关标签:
3条回答
  • 2021-01-05 07:55

    When you add OpenCV from Properties->Android->libarary->Add you need to leave "Is Library" checkbox unchecked. Go to Project->Properties->Android and uncheck "Is Library" and then try again. It should solve your issue (it did for me) but if it doesn't please take a look at the answers of this question as other people have found some other things to be helpful as well.

    0 讨论(0)
  • 2021-01-05 08:14

    When creating a new Android project, the only thing you need to do is

    • add a reference to the OpenCV project by going to Properties > Android > Library > Add and choosing the OpenCV Library project

    You should not then explicitly add OpenCV Library project into your new Android project's build path:

    • add another reference to the OpenCV project by going to Properties > Java Build Path > Projects > add...

    If you do latter step, you will get the exact error Could not find OpenCV-2.3.1.apk! described in the question.

    Check out the New Android project's build path and remove OpenCV project if it exists, then give it another try and see if this helps.

    0 讨论(0)
  • 2021-01-05 08:18

    I had this problem when I pulled in the jni_part.cpp file from a sample project. I forgot to change the names of the functions to fit the package name of the class I was using them from:

    JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures ->
    
    JNIEXPORT void JNICALL Java_<CLASSNAME_WITH_UNDERSCORES_INSTEAD_OF_DOTS>_<CLASS_NAME>_<METHOD_NAME>
    

    Hope this helps someone.

    0 讨论(0)
提交回复
热议问题