我收到以下错误:
错误:与依赖项'com.google.inject:guice'冲突。 app(3.0)和测试app(4.0)的已解决版本有所不同。有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict。
以下是我的Gradle文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public'}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.19.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'android-apt'
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/intercom/intercom-maven' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.imagecom"
minSdkVersion 16
targetSdkVersion 22
versionCode 16
versionName "3.8"
multiDexEnabled = true
testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
useLibrary 'org.apache.http.legacy'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs{
release{
storeFile file(STORE_FILE)
storePassword STORE_PASSWORD
keyAlias STORE_PASSWORD
keyPassword STORE_PASSWORD
}
debug{
storeFile file(STORE_FILE_DEBUG)
storePassword STORE_PASSWORD_DEBUG
keyAlias STORE_PASSWORD_DEBUG
keyPassword STORE_PASSWORD_DEBUG
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
//exclude 'META-INF/DEPENDENCIES'
}
dexOptions {
javaMaxHeapSize "7g"
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources true
applicationIdSuffix ".debug"
}
sourceSets.debug.resources.srcDirs = ['src/debug/res']
}
productFlavors {
imagecom {
applicationId "com.imagecom.imagecom"
versionName = "7.7"
}
greencontrol {
applicationId "com.imagecom.greencontrol"
versionName = "1.0-greencontrol"
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.3.0'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile('org.apache.httpcomponents:httpmime:4.2.3') {
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
}
compile project(':bluetoothspp')
compile('io.intercom.android:intercom-sdk:1.+@aar') {
transitive = true
}
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:multidex:1.0.1'
androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:palette-v7:23.3.0'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
compile 'me.neavo:volley:2014.12.09'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.modelmapper:modelmapper:0.7.4'
compile 'com.theartofdev.edmodo:android-image-cropper:1.0.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'me.relex:circleindicator:1.0.0@aar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.github.deano2390:MaterialShowcaseView:1.0.5'
compile 'org.roboguice:roboguice:2.0'
provided 'org.roboguice:roboblender:3.0.1'
compile 'joda-time:joda-time:2.8.2'
compile 'me.dm7.barcodescanner:zxing:1.8.3'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.2a'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.0.8'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.8'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
//Retrofit 2
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'org.apache.commons:commons-lang3:3.4'
testCompile 'junit:junit:4.12'
testCompile ('org.robolectric:robolectric:3.0'){
exclude module: 'asm'
}
androidTestCompile 'org.testng:testng:6.9.6'
androidTestCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
def appModuleRootFolder = '.'
def srcDir = 'src'
def googleServicesJson = 'google-services.json'
task switchToDebug(type: Copy) {
description = 'Switches to DEBUG google-services.json'
from "src/debug"
include "google-services.json"
into "."
}
task switchToRelease(type: Copy) {
description = 'Switches to RELEASE google-services.json'
from "src/release"
include "google-services.json"
into "."
}
task switchToDebugGreencontrol(type: Copy) {
description = 'Switches to DEBUG google-services.json'
from "src/debug/greencontrol"
include "google-services.json"
into "."
}
task switchToReleaseGreencontrol(type: Copy) {
description = 'Switches to RELEASE google-services.json'
from "src/release/greencontrol"
include "google-services.json"
into "."
}
afterEvaluate {
processimagecomDebugGoogleServices.dependsOn switchToDebug
processimagecomReleaseGoogleServices.dependsOn switchToRelease
processGreencontrolDebugGoogleServices.dependsOn switchToDebugGreencontrol
processGreencontrolReleaseGoogleServices.dependsOn switchToReleaseGreencontrol
}
以下是bluetoothspp项目的平台:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
versionCode 7
versionName "3.3"
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
}
}
}
答案 0 :(得分:1)
问题在于缓存中有重复文件,当我按下清理并重建项目选项时,这些文件既没有合并也没有被清除。
因为我已经将我的项目与bitbucket链接所以我使用source-tree将它藏起来。
以下链接将有助于如何存储: https://confluence.atlassian.com/sourcetreekb/stash-a-file-with-sourcetree-785332122.html
然后我清理并重建我的项目,错误消失了。那也应该为你们这样做。
谢谢