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

时间:2015-04-01 11:36:18

标签: android android-studio

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

  • 两个app模块;
  • 一个Android库模块;
  • 两个应用模块共享的第四个模块common

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

如果我在每个子模块的libs文件夹中添加jar文件(app,library,common),一切都会好的。

如果我将第五个模块作为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')
}

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

jar的build.gradle文件是:

configurations.create("default")
artifacts.add("default", file('Server.jar'))

可能是什么原因?

0 个答案:

没有答案
相关问题