I have an app that needs to use OpenCV and another third-party library. I followed this stackoverflow instruction to import the latest version of OpenCV (v3.4.3) and copy the .so files to /app/src/main/jniLibs. The third-party library is packed as an aar file and put in the /app/libs folder.
My app's build.gradle looks like this:
dependencies {
implementation project(':openCVLibrary343')
implementation(name: 'custom', ext: 'aar')
...
The build.gradle also has this setting that (I think) instructs Android Studio to look for the third-party library in the libs folder:
repositories {
flatDir {
dirs 'libs'
}
While the code compiles fine, I encountered an error when I tried to run the app. Basically, Android Studio complained that the third-party library is no longer found. But when I used "Build > Analyze APK" to look at what is inside the lib folder of the APK file, I found the so files from the third-party library were actually there.
Does anyone has similar problem? I have been searching for an answer for a while but didn't find anything particularly relevant. I am using Android Studio 3.2 with the latest version of Gradle.