包含jar的项目库(例如支持v7和播放服务)无法正常工作

时间:2013-10-31 22:48:46

标签: android

几个月前我切换到Android Studio,但直到最近我才从项目中添加或删除库模块。我遇到了一个问题,只是包含库模块(例如谷歌播放服务)不足以让我的应用程序进行编译。

enter image description here

我确保库模块使用自己的jar作为依赖项。参考jar可以在这里看到:

enter image description here

但除非我将库项目和这个jar库作为依赖项包含在我的主应用程序模块中,否则应用程序将无法编译。我的印象是只包含库本身应该足够了,因为它包含所有res /文件以及包含java文件的jar本身。

我通过以下方式让它发挥作用:

enter image description here

但是不应该仅仅1个项目库/模块就足够了吗?如果你看,你可以看到我需要对Android v7的appcompat库做同样的事情。

1 个答案:

答案 0 :(得分:2)

<强> You don't need to add the the compiled module (the .jar file) in the dependencies of itself module.

换句话说,一旦将模块导入项目,您唯一需要做的就是将其作为模块依赖项添加到项目中。

当您添加模块库时,Android Studio会自动生成/添加.jar文件到库,然后添加到项目的依赖项。

模块依赖性 neither does Google Play Service Module


Google Play服务库 Google play library has no dependencies


主要项目模块依赖性 But Project depends on Google Play Services Module