Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems at R.styleable while integrating native opencv to android studio

I'm addind openCV native lib into my (in developpement) project. I'm following this guide. I have troubles at the very last step, while building my project, in the OpenCV-android-sdk folder : CameraGLSurfaceView.java got error cannot find symbol variable styleable at R.styleable.CameraBridgeViewBase.

I have tried to add an attrs.xml file in my values folder with this content :

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <declare-styleable name = "CameraBridgeViewBase" >
        <attr name="show_fps" format="boolean"/>
        <attr name="camera_id" format="integer" >
            <enum name="any" value="-1" />
            <enum name="back" value="2" />
            <enum name="front" value="1" />
        </attr>
    </declare-styleable>
</resources>

As it said in this quite similar error. But nothing changed when I rebuild my project.

like image 829
Jérémy Avatar asked Jan 22 '19 21:01

Jérémy


1 Answers

In opencv 4 just change

res.srcDirs = ['/build/master_pack-android/opencv/modules/java/android_sdk/android_gradle_lib/res']

to

res.srcDirs = ['res']

in the gradle file

like image 76
Oswaldo Jaime Avatar answered Sep 29 '22 19:09

Oswaldo Jaime