2015-07-11 99 views
0

如何在您的Android项目既地图和位置谷歌发挥依赖呢?这就是我doing-添加谷歌播放服务地图和地点依赖

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:[email protected]') { 
     transitive = true; 
    } 
// compile('com.github.nkzawa:socket.io-client:0.5.2') { 
//  exclude group: 'org.json', module: 'json' 
// } 

} 

而这就是我getting- 错误:执行任务':app:processDebugResources'失败。

Error: more than one library with package name 'com.google.android.gms' You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be enforced in 1.0

回答

1

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

这已修复在映射utils.It的更新版本。

-2

删除

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

,并添加

compile 'com.google.android.gms:play-services:7.0.0' 
+0

此外,您可能不需要“编译”com.google.maps.android:android-maps-utils:0.3.1'“要么 –

+0

我已经尝试过,达到65k的限制。因此寻找替代品。 –

+0

有选择地编译你需要的API是更好的方法。 – mossplix

1

play-services-location实际上包含play-services-maps作为依赖,这样你就可以完全去除maps线。

您可以使用​​来检查确切的依赖关系来自何处 - 这可能会帮助您精确缩小哪些库也包含Google Play服务的某些部分 - 确保您还没有将其作为jar文件你的libs目录。

+0

好的,也许你是对的,但我仍然得到相同的错误。这次因为地图utils。 –

+1

compile('com.google.android.gms:play-services-location:7.8.0'){ exclude group:'com.google.android.gms',module:'play-services-maps' } – user949884

+0

@ user949884 - 当然,它是包含[LatLng](https://developers.google.com/android/reference/com/google/android/gms/maps/model/LatLng)的“play-services-maps”,位置的一个重要部分(以及潜在依赖背后的原因)。 – ianhanniballake

0

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

相关问题