Android Gradle中多个项目的库重写问题

Android Gradle中多个项目的库重写问题,android,google-maps,android-studio,gradle,Android,Google Maps,Android Studio,Gradle,我使用安卓工作室。我需要使两个应用程序一起工作。问题是他们都使用谷歌地图API。第一个应用程序使用API V8.3.0,另一个应用程序使用更旧的版本(我不知道确切的版本,但库位于.jar中,google在以前的版本中使用了该库) 当我构建单个项目时,没有导入“跟踪器”,一切都正常。但当我添加第二个项目时,我得到了下一个错误: Error:(91, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCa

我使用安卓工作室。我需要使两个应用程序一起工作。问题是他们都使用谷歌地图API。第一个应用程序使用API V8.3.0,另一个应用程序使用更旧的版本(我不知道确切的版本,但库位于.jar中,google在以前的版本中使用了该库)

当我构建单个项目时,没有导入“跟踪器”,一切都正常。但当我添加第二个项目时,我得到了下一个错误:

Error:(91, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCallback>)
我如何解决这个问题

以下是我的主项目Gradle文件的依赖项:

dependencies {
    apt "org.androidannotations:androidannotations:+"
    compile files('libs/splunk-mint-4.2.1.jar')
    compile project(':vksdk_library')
    compile project(':odnoklassniki-android-sdk')
    compile project(':viewpager_library')
    compile project(':tracker') //second project


    compile 'org.androidannotations:androidannotations-api:+'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:+'
    compile 'com.squareup.okhttp:okhttp:+'
    compile 'com.squareup.okhttp:okhttp-urlconnection:+'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'org.codehaus.jackson:jackson-mapper-asl:+'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.google.android.gms:play-services-maps:8.3.0'
    compile 'com.google.android.gms:play-services-location:8.3.0'
}
下面是我的子项目,我将其作为模块导入:

dependencies {
    compile project(':SlidingMenu')
    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/httpcore-4.4.3.jar')
    compile files('libs/google-play-services.jar')
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
}

我不认为您的
googleplay services.jar
包含方法
getmapsync
,因为它是新添加的,所以您需要更新的googleplay服务库。问题是google-play-services.jar存在于第二个项目中,需要使用此版本。但是出于未知的原因,gradle也尝试在第一个项目中使用这个库(在那里我导入了最新的google服务)更改顺序?首先编译8.3,然后编译第二个项目。或者在gradle中使用
exclude
,检查这里:我猜,只是更改依赖项的顺序,但可能不起作用,我建议您检查gradle中的
exclude
标记谢谢,我现在就试试
dependencies {
    compile project(':SlidingMenu')
    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/httpcore-4.4.3.jar')
    compile files('libs/google-play-services.jar')
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
}