添加Google Play服务地图和位置依赖项

时间:2015-07-11 04:15:58

标签: android android-studio google-play-services

如何在Android项目中包含地图和位置google play依赖项?这就是我正在做的事情 -

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.maps.android:android-maps-utils:0.3.1'
    compile 'com.google.android.gms:play-services-maps:7.5.0'
    compile 'com.google.android.gms:play-services-location:7.5.0'
    compile 'com.jakewharton:butterknife:6.0.0'
    compile 'com.jakewharton.timber:timber:2.5.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
    compile 'com.squareup.okhttp:okhttp:2.2.0'
    compile 'io.reactivex:rxandroid:0.24.0'
    compile('eu.inmite.android.lib:android-validation-komensky:0.9.2') {
        exclude module: 'support-v4'
    }
    compile 'com.squareup:otto:1.3.7'
    compile project(':libstreaming')
    compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
        transitive = true;
    }
//    compile('com.github.nkzawa:socket.io-client:0.5.2') {
//        exclude group: 'org.json', module: 'json'
//    }

} 

这就是我得到的 - 错误:任务':app:processDebugResources'执行失败。

  

错误:多个包含包名称的库' com.google.android.gms'     您可以使用android.enforceUniquePackageName = false暂时禁用此错误     但是,这是暂时的,将在1.0

中强制执行

4 个答案:

答案 0 :(得分:1)

play-services-location实际上包含play-services-maps作为依赖项,因此您可以完全删除maps行。

您可以使用./gradlew dependencies检查某些依赖项的来源 - 这可能有助于您准确缩小哪些库也包含Google Play服务的部分内容 - 确保您也没有将其作为您的libs目录中的jar文件。

答案 1 :(得分:1)

我更改了这个编译'com.google.maps.android:android-maps-utils:0.3.1' 编译'com.google.maps.android:android-maps-utils:0.3.4'。

这已在map utils.st的更新版本中修复。

答案 2 :(得分:0)

您只需要删除完整的播放服务依赖包,并仅添加必需的依赖项,例如。编译com.google.android.gms:play-services-location:10.0.1'如果您正在使用位置服务并编译com.google.android.gms:play-services-maps:10.0.1'如果你正在使用地图服务。

答案 3 :(得分:-2)

删除

 <choice>
 <when expression="#[message.payload['interface_id'] == 'BK131108.1655.000698']" evaluator="map-payload">
     <processor-chain doc:name="Processor Chain">
  </when>
 </choice>

并添加

    compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'