2013-08-08 2 views
6

내 Eclipse에서 OpenCV 및 Android를 설정했습니다.Android OpenCV : 패키지의 속성 'camera_id'에 대한 리소스 식별자가 없습니다.

<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="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

    <org.opencv.android.JavaCameraView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:visibility="gone" 
     android:id="@+id/hello" 
     opencv:show_fps="true" 
     opencv:camera_id="any" /> 
</LinearLayout> 

이클립스 컴파일러에 대한 불평 : 다음은 내 레이아웃 파일 중 하나입니다 ..

No resource identifier found for attribute 'show_fps' in package 
No resource identifier found for attribute 'camera_id' in package 
+0

에 라이브러리를 추가 할 필요가

  • OpenCV의 라이브러리를 추가하고 선택 Android Studio에서도 이와 동일한 문제가있었습니다. OpenCVLibraryXXX 프로젝트/모듈을 컴파일하여이 문제를 해결해야했습니다. – CodyF

  • 답변

    0

    당신이 제공하고 있지 않습니다 변수의 값 여부는 OpenCV의 클래스에 선언

    opencv { 
    
        show_fps="true" 
        camera_id="any" 
    
        } 
    
        First assign the those two variables globally with necessary values.... 
    
    6

    프로젝트의 디렉토리에 다음 리소스 파일을 추가하십시오.

    attrs.xml 
    
    다음과 같은 내용으로

    는 :

    <?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="0" /> 
          <enum name="front" value="1" /> 
         </attr> 
        </declare-styleable> 
    </resources> 
    
    1

    이 질문에 두 개의 이전에 주어진 답변, 내 의견으로는, 실제 문제에 bandaids 있습니다. 이 오류 메시지가 발생하면 일부 프로젝트 속성을 변경해야했습니다.

    1. 오른쪽 클릭 프로젝트와 트리 컨트롤에서 속성을 선택
    2. 선택 '안드로이드'를
    3. OpenCV의 라이브러리가 있고 녹색 체크 표시가 있는지 확인은 '도서관'섹션에 옆에 (볼 아래 이미지)

    Successfully linked OpenCV Library

    OpenCV의 라이브러리가 존재하지 않거나, 당신이 라이브러리 의존성을 수정해야 그 옆에 빨간색 X가있는 경우이다. 이렇게하려면 다음을 수행

    1. 하는 (필요한 경우) 깨진 라이브러리를 제거
    2. 클릭 OpenCV의 라이브러리가없는 경우, 프로젝트
    +0

    감사합니다. 이것이 실제로 내 문제를 해결 한 것입니다. –

    관련 문제