Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cannot find class JavaCameraView declared in xml

I have added openCv library to my project. There is no problem to import any openCv class into my .java file. But when I added this to my xml:

<org.opencv.android.JavaCameraView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/camera_surface_view" />

I get this error while running the application:

  05-18 19:26:54.420: E/AndroidRuntime(30676): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.szpieg2/com.example.szpieg2.TrackActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class org.opencv.android.JavaCameraView

Sample projects using JavaCameraView are working on my device(Galaxy Note II) I do not understand why it cannot locate it in one project and does in the other. Maybe I did not setup something? Please help.

Full XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:opencv="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     >

     <org.opencv.android.JavaCameraView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/color_blob_detection_activity_surface_view" />


</LinearLayout>