AndroidでOpenCVを使うときのエラー
下のようなメッセージが出力されてビルドができない状態でした。
ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: openCVLibrary2411
解決方法として参考にしたサイトは以下です。
結論
エラーメッセージの通りに修正してやれば直しました。
実施したこと
- インポートしたopencvライブラリのプロジェクトのbuild.gradleファイルにある以下のコードをコメントアウト
defaultConfig { // minSdkVersion 4 // 8 targetSdkVersion 26 // 8 }
- 「The minSdk version should not be declared in the android manifest file」が出力されたので、OpenCVライブラリのプロジェクトにあるAndroidManifest.xmlを修正
<修正前><uses-sdk android:minSdkVersion="26" />
<修正後>
<!--- <uses-sdk android:minSdkVersion="26" /> --->
これで、ビルドエラーの解消ができました。
でわでわ。。。