質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

0回答

862閲覧

Android Studio3.5.3 OpenCVを導入したい

isisisimylife

総合スコア42

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2020/02/01 15:01

前提・実現したいこと

Android Studio3.5.3にOpenCVを導入しよと試みています。

発生している問題・エラーメッセージ

下記のリンクを参考にOpenCVをImport,moduleの依存関係の追加,gladleの書き換えを行った。
しかし次のようなエラーがでる。

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.

参考にしたページ

###該当するコード
minSdkのバージョンをandroid manifest内で宣言しちゃだめとあったのでAndoroidManifest.xmlを確認したが思い当たる記述がなかった。

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

###build.gradle(Module:app)

apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.example.myapplication" minSdkVersion 29 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' }

###build.gradle(Module:opencv)

apply plugin: 'com.android.library' println "OpenCV: " + project.buildscript.sourceFile android { compileSdkVersion 29 //buildToolsVersion "27.0.3" // not needed since com.android.tools.build:gradle:3.0.0 defaultConfig { minSdkVersion 29 targetSdkVersion 29 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_6 targetCompatibility JavaVersion.VERSION_1_6 } sourceSets { main { jniLibs.srcDirs = ['native/libs'] java.srcDirs = ['java/src'] aidl.srcDirs = ['java/src'] res.srcDirs = ['java/res'] manifest.srcFile 'java/AndroidManifest.xml' } } } dependencies { }

補足情報(FW/ツールのバージョンなど)

Android Studioのバージョン:Android Studio3.5.3
Android SDK Toolsのバージョン:26.1.1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hoshi-takanori

2020/02/10 05:00

参考にされたページの手順通りにやって成功しました。 (OpenCV Version 4.2.0 と表示された。) OpenCV はどこから、バージョンいくつをダウンロードされましたか? 手元のファイルと比べてみましたが、 ・build.gradle(Module:app) 参考ページの手順(moduleの依存関係の追加)の結果、implementation project(path: ':opencv') という行が追加されるはずです。 ・build.gradle(Module:opencv) externalNativeBuild などの内容が足りない気がします。(OpenCV のバージョン違いのせいかもしれませんが。)
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問