具有多个模块的 Android Studio 项目中的 Jar 文件

Ant*_*sto 5 android android-studio

我有一个包含 4 个模块的 Android Studio 项目:

  • 两个应用模块;
  • 一个Android库模块;
  • common在两个应用程序模块之间共享的第四个模块。

所有模块都依赖于其他人开发的 jar 文件。

如果我在libs每个子模块(应用程序、库、common)的文件夹中添加 jar 文件,一切都很好。

如果我将第五个模块添加到项目中Import .JAR or .AAR package module并在每个子模块中依赖它,则没有模块在 jar 文件中找到类。

如果我查看build.gradle两个应用程序之一的命令,我会读到:

...
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(':library.myproject.com')
    compile 'com.squareup.okhttp:okhttp:2.2.0'
    compile 'com.squareup.okio:okio:1.2.0'
    compile project(':CommonClasses')
    compile project(':servicesJar')
}
Run Code Online (Sandbox Code Playgroud)

上的依赖关系:library.myproject.com:CommonClasses正常。对 jar 文件的依赖:servicesJar不是。

build.gradlejar的文件是:

configurations.create("default")
artifacts.add("default", file('Server.jar'))
Run Code Online (Sandbox Code Playgroud)

可能是什么原因?