【问题标题】:Unable to resolve dependency for ':app@debug/compileClasspath': Cannot convert URL 'com.google.android.gms:play-services-maps:17.0.0' to a file无法解析 ':app@debug/compileClasspath' 的依赖关系:无法将 URL 'com.google.android.gms:play-services-maps:17.0.0' 转换为文件
【发布时间】:2019-09-29 15:00:39
【问题描述】:

我正在 youtube 上通过 Android Coding 构建 Google 地图演示。我构建了应用程序,但由于某种原因,我不断收到错误消息

无法将 URL 'com.google.android.gms:play-services-maps:17.0.0' 转换为文件。

这是我的build.gradle(Project Google Maps Demo):

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
        repositories {
            google()
            jcenter()
            mavenLocal()

        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
            classpath 'com.google.gms:google-services:4.0.1'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://maven.fabric.io/public' }
            maven {
                url "https://maven.google.com"
            }
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

有人可以帮忙吗? 编辑:复制并粘贴相同的代码两次,这是我的实际 build.gradle(module: app)**

这是我的app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.zydavia.googlemapsdemo"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation files('com.google.android.gms:play-services-maps:17.0.0')
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'androidx.navigation:navigation-fragment:2.1.0'
    implementation 'androidx.navigation:navigation-runtime:2.1.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
}

【问题讨论】:

  • 发布模块/build.gradle 文件
  • 已发布!你能看出问题吗?

标签: android google-maps-api-3 android-gradle-plugin google-play-services


【解决方案1】:

删除这一行:

//implementation files('com.google.android.gms:play-services-maps:17.0.0')

【讨论】:

  • 仍然没有 binkie。在我运行程序之前,我也被警告说我的“配置仍然不正确”,并询问我是否要继续。我愿意。我试过更新 Build.gradle 和 google play 还是不行。
  • @fiendishbrokeboi 你有同样的错误还是另一个错误?不清楚
  • 谢谢!我确实有同样的错误,但重启 Android Studio 后,它可以工作了!
  • 嗨@fiendishbrokeboi,如果这个或任何答案解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
猜你喜欢
  • 1970-01-01
  • 2018-12-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多