简体   繁体   English

无法解决:com.google.maps.android:android-maps-utils:0.4+

[英]Failed to resolve: com.google.maps.android:android-maps-utils:0.4+

Trying to build Google Maps Android API utility library , I have SDK 23 installed and all the right SDK tools . 尝试构建Google Maps Android API实用程序库时 ,我安装了SDK 23和所有正确的SDK工具 At first when i imported the project I wasn't able to run it, the run button was greyed out. 最初,当我导入项目时,我无法运行它,运行按钮显示为灰色。 I then added "apply plugin: 'com.android.application'" to the top of gradle file. 然后,我在gradle文件的顶部添加了“ apply plugin:'com.android.application'”。 Then when i try to compile, I get the Failed to resolve: com.google.maps.android:android-maps-utils:0.4+ error in my build gradle(module: library). 然后,当我尝试编译时,我无法解决:com.google.maps.android:android-maps-utils:0.4+错误在我的构建gradle(模块:库)中。

dependencies {
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
 }

dependencies section in original android-maps-utils-master/demo/build.gradle contains: 原始android-maps-utils-master / demo / build.gradle中的依赖项部分包含:

dependencies {
    compile project(':library')
    // Or, fetch from Maven:
//     compile 'com.google.maps.android:android-maps-utils:0.3+'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
}

So: 所以:

  1. You may use it as it is. 您可以按原样使用它。 Library android-maps-utils will be compiled from " compile project(':library') ". 库android-maps-utils将通过“ compile project(':library') ”进行编译。 It works for me. 这个对我有用。 Or 要么
  2. You may comment " compile project(':library') ", then uncomment " compile 'com.google.maps.android:android-maps-utils:0.3+' " and the library will be downloaded from maven repository. 您可以注释“ compile project(':library') ”,然后取消注释“ compile'c​​om.google.maps.android:android-maps-utils:0.3+' ”,该库将从maven存储库下载。 But ) 但是)

Gradle has no idea where it is. Gradle不知道它在哪里。 So you should add the followilg code: 因此,您应该添加以下代码:

allprojects {
    repositories {
        mavenCentral()
    }
}

into the file android-maps-utils-master/build.gradle 进入文件android-maps-utils-master / build.gradle

This actually works: 这实际上有效:

Comment out the other dependencies where any google Api is called. 注释掉任何调用Google Api的其他依赖项。 Specifically, firebase ( compile 'com.google.firebase:firebase-ads:9.0.1' ) and gms( compile 'com.google.android.gms:play-services-maps:9.0.1' ). 具体来说,firebase(编译'com.google.firebase:firebase-ads:9.0.1')和gms(编译'com.google.android.gms:play-services-maps:9.0.1')。 Now go for 'Sync Now'. 现在转到“立即同步”。

You may encounter some other error, like some value is missing. 您可能会遇到其他错误,例如缺少某些值。 Ignore the errors, uncomment the commented dependencies and Voila! 忽略错误,取消注释注释的依赖项,瞧! It all has been figured out by our dear Gradle! 这一切已由我们亲爱的Gradle找出来!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM