库依赖项不适用于模块

时间:2019-01-03 14:52:41

标签: java android

我正在使用Android Studio。我有两个模块:应用程序(UI)和库。分别测试时,它们应按预期进行编译和工作,但是当我尝试在应用程序上使用某些库类时,无法构建项目。我收到此错误:

Android Studio screenshot of failed build

  

错误:程序类型已存在:org.apache.xmlbeans.xml.stream.Location

我的图书馆build.gradle只有几行:

apply plugin: 'java-library'


dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.poi:poi-ooxml:3.17'

}

sourceCompatibility = "7"
targetCompatibility = "7"

然后我的应用程序的build.gradle是这个

android {
compileSdkVersion 28
defaultConfig {
    applicationId "skrb.appprueba"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation project(path: ':coreLib')

}

添加此(implementation project(path: ':coreLib')时,出现错误,我不知道如何解决。

我尝试过的事情

  • 清洁和重建项目。
  • multiDexEnabled 设置为 true

2 个答案:

答案 0 :(得分:0)

尝试这个:

implementation(project(path: ':coreLib')) {
    exclude module: 'poi'
    exclude module: 'poi-ooxml'
}

Here,您可以找到导致此错误的更多信息。

答案 1 :(得分:0)

根据错误消息,它应该是:

ix1 = df[df['distance'] > i].iloc[0].name
ix2 = (~(df.loc[ix1:, 'angle'] >= j)).idxmax()-1
l = df.loc[ix1:ix2,:]

list(l.to_records(index=False))
[(10, 10, 6), (10, 15, 4), (10, 20, 5)]