如何解决将模块导入 Android 项目后,Gradle Build 失败
我正在尝试从 here 导入 Agora.IO
模块以实现屏幕共享功能。在提供的链接上克隆存储库并将其添加为我的项目的 Module
后,我能够正确获取所有 imports
。我需要的唯一导入是 import io.agora.api.*
,但构建失败并显示以下消息。
Execution failed for task ':lib-switch-external-video:compileDebugAidl'.
> Could not resolve all files for configuration ':lib-switch-external-video:debugCompileClasspath'.
> Could not find com.github.agorabuilder:native-full-sdk:3.4.2.
Required by:
project :lib-switch-external-video > project :lib-component
Possible solution:
- Declare repository providing the artifact,see the documentation at
https://docs.gradle.org/current/userguide/declaring_repositories.html
这是导入模块后我的项目结构的样子:
虽然我对 multi-module
应用还没有太多经验,但我已经将这些添加到我的 settings.gradle
文件中:
settings.gradle
rootProject.name = "dummy"
include ':app'
include ':lib-push-externalvideo'
include ':lib-screensharing'
include ':lib-player-helper'
include ':lib-stream-encrypt'
include ':lib-component'
include ':lib-raw-data'
include ':lib-switch-external-video'
在我找到的 build.gradle
模块的默认 lib-component
中
api 'com.github.agorabuilder:native-full-sdk:3.4.2'
api 'io.agora:agoraplayer:1.2.4'
在这些模块的 build.gradle
中,已经添加了以下任一模块:
implementation project(path: ':lib-component')
or
api project(path: ':lib-component')
我选择导入这些模块的唯一原因是我找不到支持这些导入的 gradle
依赖项。如果有这样的依赖,请告诉我!
解决方法
邮件中完全提到了这个问题。 Gradle 无法解析模块中添加的任何存储库中的 const app = express();
依赖项。
你在那里定义了 jitpack 存储库吗?
const app = express
此外,与您的问题不同,您的 settings.gradle 文件似乎有点不同。我假设您已将所有源代码复制到您的项目中。
相反,在这种情况下,我会选择链接它们而不是复制源。为此,您可以使用
com.github.agorabuilder:native-full-sdk:3.4.2
当你调试一个你看起来是的库时,更喜欢这个。这样,您在此构建中添加该确切模块,并且在此处进行的任何更改将实际发生在该项目中。允许您简单地提交或更改该存储库中的分支。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。