简体   繁体   English

如何在android maven项目中添加apklib依赖项?

[英]How can I add an apklib dependency to your android maven project?

I have an android project which I am developing on eclipse and building with maven. 我有一个Android项目,我正在日食和maven建设。 I wanted to include a lib (apklib) in it, and similarly to other includes, I have tried appending the dependency to my pom in the following way: 我想在其中包含一个lib(apklib),与其他包含类似,我尝试通过以下方式将依赖项附加到我的pom:

<dependency>
    <groupId>groupID.name</groupId>
    <artifactId>artifact.name</artifactId>
    <version>version</version>
</dependency>

However, when trying to build it either from m2eclipse or from maven on the console, I would get an error 但是,当尝试从m2eclipse或控制台上的maven构建它时,我会收到错误

(Failed to execute goal on project projectName : Could not resolve dependencies for project project Failure to find apklib in repo was cached in the local repository, resolution will not be reattempted until the update interval of repo has elapsed or updates are forced) (无法在项目projectName上执行目标:无法解析项目项目的依赖项未能在repo中找到apklib已缓存在本地存储库中,在重新启动repo的更新间隔或强制更新之前,不会重新尝试解析)

saying that this dependency could not be found even if I can see the dependency in my .m2 directory 说即使我可以在我的.m2目录中看到依赖项,也无法找到此依赖项

The solution was quite simple, but since I found it through an example trying to demonstrate something else, rather than a Q&A (and I did not find it easily in the maven-android-plugin project,) I decided to share it here with the hope it can help someone. 解决方案非常简单,但是因为我通过一个示例尝试演示其他内容,而不是Q&A(我在maven-android-plugin项目中没有轻易找到它),我决定在这里与它分享希望它可以帮助某人。

The solution was just to set my dependency type to apklib in this way: 解决方案只是以这种方式将我的依赖类型设置为apklib:

<dependency>
    <groupId>groupID.name</groupId>
    <artifactId>artifact.name</artifactId>
    <version>version</version>
    <type>apklib</type>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM