Android opencv import issues

17 views
Skip to first unread message

Stavros Malakoudis

unread,
Jun 20, 2024, 5:56:08 PM6/20/24
to javacv
Hi there! I'm facing the following issue when trying to import opencv on Android. Although there are countless examples on how to do that, nothing has worked for me yet. The problem here is that most of the examples are for an older gradle version and do not use the newer Kotlin DSL scirpting to configure the dependencies. 

I'm attaching both the application and the top level gradle files. My problem is exactly what's shown on the screenshot: windows-import.png

Although Android Studio can find the org.bytedeco.opencv (also openblas, ffmpeg etc), the only possible child import that exists is 'windows-x86_64'.  I am using the gradle-javacpp plugin but it didn't seem to do much. My gradle version is 8.7. 

I also tried importing the  javacpp-android-arm64 and opencv-android-arm64 jar files, but this time Android Studio couldn't even find the org.bytedeco package. I'm pretty sure I'm missing something pretty minor, but I can't figure it out. Any help is appreciated!

Thank you in advance.
top.level.build.gradle.kts
app.build.gradle.kts

Samuel Audet

unread,
Jun 20, 2024, 7:02:37 PM6/20/24
to jav...@googlegroups.com, Stavros Malakoudis
As shown here, make sure to add a dependency only on opencv-platform,
not on anything else:
https://github.com/bytedeco/javacpp-presets?tab=readme-ov-file#downloads

On 6/21/24 03:26, Stavros Malakoudis wrote:
> Hi there! I'm facing the following issue when trying to import opencv on
> Android. Although there are countless examples on how to do that,
> nothing has worked for me yet. The problem here is that most of the
> examples are for an older gradle version and do not use the newer Kotlin
> DSL scirpting to configure the dependencies.
>
> I'm attaching both the application and the top level gradle files. My
> problem is exactly what's shown on the screenshot: windows-import.png
Reply all
Reply to author
Forward
0 new messages