OpenCVを使用したAndroidアプリを開発するため、Android StudioにOpenCV4.1をインポートしてMainActivity.javaに以下のプログラムを記述しました。
MainActivity.java
package com.example.moviefilter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import org.opencv.android.OpenCVLoader; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(!OpenCVLoader.initDebug()){ Log.i("OpenCV", "Failed"); }else{ Log.i("OpenCV", "successfully built!"); } } }
しかし、実行するとOpenCV側のCameraGLRendererBase.javaとCameraGLSurfaceView.javaで以下のエラーが表示されます。
エラー: シンボルを見つけられません シンボル: 変数 styleable 場所: クラス R
CameraGLRendererBase.javaのエラー周辺箇所
public CameraBridgeViewBase(Context context, AttributeSet attrs) { super(context, attrs); int count = attrs.getAttributeCount(); Log.d(TAG, "Attr count: " + Integer.valueOf(count)); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false)) enableFpsMeter(); mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); getHolder().addCallback(this); mMaxWidth = MAX_UNSPECIFIED; mMaxHeight = MAX_UNSPECIFIED; styledAttrs.recycle(); }
CameraGLSurfaceView.javaのエラー周辺箇所
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle();
res/values/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="99" /> <enum name="front" value="98" /> </attr> </declare-styleable> </resources>
R.styleableが見つからない原因として何が考えられるでしょうか。
どうかご教授の程よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/26 04:31