无法将 openCV 模块添加为我的应用程序的依赖项 [英] Cant add openCV module as a dependency to my app

查看:120
本文介绍了无法将 openCV 模块添加为我的应用程序的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 openCV 库添加到我的应用程序中,我从 source forge 下载了最新版本 4.5.2

I'm trying to add the openCV library to my app, I downloaded the latest version 4.5.2 from source forge

我使用 file>new>import module 并选择 OpenCV-android-sdk/sdk/java 添加它模块,正如所有在线说明所建议的

I add it module using file>new>import module and selecting OpenCV-android-sdk/sdk/java as all the online instructions suggest

然后我去项目 structure>dependencies 将该模块添加为依赖项,但我刚刚添加的模块并没有如何.它的疯狂是因为在它后面的窗口中,您可以看到它看到的是我添加的 openCv 模块,但它不知何故无法将其识别为可以依赖的模块.我知道我可以在 build.gradle 中手动添加它,但最终结果不起作用,我觉得这个问题和更大的问题之间存在关联.

Then I go project structure>dependencies to add that module as a dependency, but the module I just added doesnt how up. And its crazy cuz in the window behind it you can see that it see’s my added openCv module, but it somehow doesn't recognize it as a module that can be depended on. I know I can manually add it in build.gradle, but the end result is not working and I have feeling there’s a corrolation between this issue and the bigger problem.

该模块是否需要包含一些特殊的东西,以便 AS 将其视为可以依赖的真正模块?

Is there something special the module need to contain in order for AS to see it as a real module that can be depended on?

推荐答案

事实证明,有关如何将 openCV 添加到 Android 的所有说明都已过时.它们都基于旧版本的 openCV,需要您导入您下载的 sdk 的 .../sdk/java 子文件夹.

Turns out that all of the instructions on how to add openCV to Android are out dated. They are all based on an older version of openCV that require you to import the the .../sdk/java subfolder of the sdk you download.

但在最新的 openCv 下载中,该文件夹没有 build.gradle 文件,因此 android Studio 会自动为其生成一个.但是这个自动生成的 build.gradle 没有正确的设置来使模块正常工作并被 AS 视为一个可靠的模块.

But in the latest openCv download that folder doesn't have a build.gradle file, and thus android Studio auto generates one for it. But this autogenerated build.gradle doesn't have the right settings for the module to work properly and be seen by AS as a depend-able module.

解决办法是导入整个../sdk文件夹

The solution is to import the whole ../sdk folder

这篇关于无法将 openCV 模块添加为我的应用程序的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆