2016-12-21 15 views
0

私はAndroidスタジオ2.2.3とOpenCV 3.1.0を使用しています。私は多くのエラーを解決しましたが、このエラーを解決できませんでした。エラー:(3、10) 'opencv2/opencv.hpp'ファイルが見つかりません

これは私のBuild.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.1" 
    defaultConfig { 
     applicationId "com.example.ahmedarif.fyp3" 
     minSdkVersion 19 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 

    sourceSets.main { 
     jni.srcDirs = [] //disable automatic ndk-build call 
    } 
    task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { 
     commandLine "C:\\Android\\sdk1\\ndk-bundle/ndk-build.cmd", 
       'NDK_PROJECT_PATH=build/intermediates/ndk', 
       'NDK_LIBS_OUT=src/main/jniLibs', 
       'APP_BUILD_SCRIPT=src/main/jni/Android.mk', 
       'NDK_APPLICATION_MK=src/main/jni/Application.mk' 
    } 
    tasks.withType(JavaCompile) { 
     compileTask -> compileTask.dependsOn ndkBuild 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } } 


    dependencies { 
     compile fileTree(include: ['*.jar'], dir: 'libs') 
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     compile 'com.android.support:appcompat-v7:25.1.0' 
     testCompile 'junit:junit:4.12' 
     compile project(':openCVLibrary310') 
    } 
} 

enter image description here

である私もph0b

からbuigl.gradleを試みたが、そのbuild.gradleはNDK-bulid.cmdに関するエラーを示します。私はほとんどすべてを試しましたが、私にとってはうまくいかなかったのです。これを取り除くのに役立ちます。 Tahnx

答えて

1

enter image description here

そして、私のbuild.gradle。

apply plugin: 'com.android.application' 
 

 
android { 
 
    compileSdkVersion 24 
 
    buildToolsVersion "24.0.1" 
 

 
    defaultConfig { 
 
     applicationId "com.c.a.engineer.imageprocessingpre" 
 
     minSdkVersion 16 
 
     targetSdkVersion 24 
 
     versionCode 1 
 
     versionName "1.0" 
 
    } 
 
    buildTypes { 
 
     release { 
 
      minifyEnabled false 
 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
 
     } 
 
    } 
 
    sourceSets { main { jni.srcDirs = [] 
 
     jniLibs.srcDir 'src/main/jniLibs' } } 
 

 
} 
 

 
dependencies { 
 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
 
    testCompile 'junit:junit:4.12' 
 
    compile 'com.android.support:appcompat-v7:24.2.1' 
 
    compile 'com.android.support:recyclerview-v7:24.2.1' 
 
    compile 'com.android.support:design:24.2.1' 
 
    compile project(':openCVLibrary310') 
 
}

それは私のための仕事です。これを試すことができます。そして私は画像処理アプリを開発しました。この私のアプリのスクリーンショット。あなたはアンドロイドスタジオの最新バージョンを使用している場合

enter image description here

+0

あなたはNDKを使用した同じbuild.gradleをusnigています?? build.gradleでは、NDKパスといくつかの.mkファイルを与えなければならないので、 –

+0

ナンバーはNDKを使用しませんでした。しかし、その仕事。それを試してみてください。私は別の方法を示したかった。多分私は助けることができると思った。 – caliskan

+0

あなたはout ndkでネイティブ関数を使うことはできないと思います。 –

0

だけ使用してhere からCおよびC++のサポートが組み込まれて、私は

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.1" 
    defaultConfig { 
     applicationId "com.example.ahmedarif.fyp3" 
     minSdkVersion 19 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 

     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 

    sourceSets.main { 
     jni.srcDirs = [] //disable automatic ndk-build call 
    } 
    task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { 
     commandLine "C:\\Android\\sdk1\\ndk-bundle/ndk-build.cmd", 
       'NDK_PROJECT_PATH=build/intermediates/ndk', 
       'NDK_LIBS_OUT=src/main/jniLibs', 
       'APP_BUILD_SCRIPT=src/main/jni/Android.mk', 
       'NDK_APPLICATION_MK=src/main/jni/Application.mk' 
    } 
    tasks.withType(JavaCompile) { 
     compileTask -> compileTask.dependsOn ndkBuild 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } } 


    dependencies { 
     compile fileTree(include: ['*.jar'], dir: 'libs') 
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     compile 'com.android.support:appcompat-v7:25.1.0' 
     testCompile 'junit:junit:4.12' 
     compile project(':openCVLibrary310') 
    } 
} 
関連する問題