【发布时间】:2016-04-28 02:45:54
【问题描述】:
问题是在我将领域库添加到我的项目后发生的。我在我的 gradle 项目中有这个依赖:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
我在 StackOverflow 中找到了很多答案,并且我测试了其中的很多,但我没有成功。试过这个answer 和这个answer 但我认为我的问题更具体。
我还添加了 LogCat 错误的建议,但我得到了同样的错误。任何答案将不胜感激。
为了更好看,我提供了完整错误的图像。
【问题讨论】:
-
您是否尝试按照错误消息中的说明进行操作? “您可以在 build.gradle 中忽略这些文件...”?
-
@CommonsWare 是的,我添加了指令,就像它在正确的 android 标签中显示的那样,` exclude 'META-INF/services/javax.annotation.processing.Processor'`。我不知道我是否必须忽略其他文件。
-
您可能希望发布完整的
build.gradle文件。 -
@CommonsWare 我编辑并添加了完整的 gradle 文件
-
尝试将
android闭包移到dependencies闭包之后。