简体   繁体   English

Java库无法引用依赖类

[英]Java library can't reference classes in dependency

I'm trying to build an annotation processor for an Android SDK, which is distributed as an AAR. 我正在尝试为Android SDK(作为AAR分发)构建注释处理器。 This annotation processor should not be distributed with the SDK so I am building it as a separate JAR, in a separate project. 该注释处理器不应随SDK一起分发,因此我将其作为一个单独的JAR构建在一个单独的项目中。

When creating the Java library project, I am unable to import classes (annotations in this case) from the SDK AAR. 创建Java库项目时,无法从SDK AAR导入类(在这种情况下为注释)。 I've added the AAR as a dependency and verified that it is resolving it correctly (it comes from a custom Maven repository) during the build: 我添加了AAR作为依赖项,并验证了它在构建过程中是否可以正确解析它(来自自定义Maven存储库):

图片 The AAR in question is obbsdk.aar 有问题的AAR是obbsdk.aar

I've opened up the archive and ensured that the classes I am referencing are in the AAR that is being resolved. 我打开了档案,并确保我要引用的类在正在解析的AAR中。 I'm not sure what else I should look at since it seems to me that the things to verify are that the classes are there and the AAR is referenced. 我不确定我还应该看什么,因为在我看来,要验证的是类在那里并且引用了AAR。

Any suggestions would be much appreciated! 我们欢迎所有的建议!

I believe the fundamental issue I was running into was having a 'java-library' project depend on an 'com.android.library' project. 我相信我遇到的基本问题是有一个“ java-library”项目依赖于一个“ com.android.library”项目。 I fixed the issue by moving the functionality I need to share out of the SDK into a separate java library and then having both libraries use that as a dependency. 通过将需要共享的功能从SDK移出到单独的Java库中,然后让两个库都将其用作依赖项,我解决了该问题。

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

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