Reputation: 33901
My project compiles fine, but Android Studio panics because it thinks it can't find opencv's modules:
OpenCV is included as a separate module, and it's listed as a dependency. As far as I can tell it's all set up fine. OpenCV's build.gradle
is as follows:
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 2480
versionName "2.4.8"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
}
}
}
Any idea what's going on? I'm not too bugged as I said, it compiles and runs absolutely fine. It is very annoying though.
Upvotes: 6
Views: 637
Reputation: 33901
Finally cracked this one. Following some online guides (I can't remember now which one), I'd installed opencv into /libraries/opencv/
in my project. The problem was that the code was in the directory ./src/main/java/org/opencv/[module]
, and this was causing classpath problems.
To solve the problem, I moved ./src/main/java/org
to ./src/org
. I did this in my file manager, not in Android Studio, and then rebuilt the project.
The project compiles fine, and all the errors are gone.
Upvotes: 3