2016-07-03 84 views
0

我收到以下错误:的冲突依赖“com.google.inject:吉斯”

错误:与冲突相依“com.google.inject:吉斯”。应用程序(3.0)和测试应用程序(4.0)的已解决版本不同。详情请参阅http://g.co/androidstudio/app-test-app-conflict

以下是我的摇篮文件:

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:[email protected]') { 
    transitive = true; 
} 

compile project(':bluetoothspp') 
compile('io.intercom.android:intercom-sdk:[email protected]') { 
    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:[email protected]' 
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项目的gradle产出:

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

你能分享一下'bluetoothspp'项目的build.gradle吗? – yonisha

+0

您好,我已经添加了gradle for bluetoothspp也 –

+0

正如在错误中提供的链接中提到的,两个不同版本的*'com.google.inject:guice'*被您的依赖关系引用。我建议运行:'** gradlew :dependencies **'来检查谁依赖它并消除重复。 – yonisha

回答

1

的问题是与有重复的文件,既不得到合并,也没有得到清除缓存当我按下清理并重建项目选项。

因为我已经将我的项目与bitbucket链接了所以我使用源码树将它储存起来。

下面的链接将是对如何藏匿有帮助: https://confluence.atlassian.com/sourcetreekb/stash-a-file-with-sourcetree-785332122.html

,然后我清理和重建我的项目和错误不见了。那也应该为你们做。

谢谢