android - Unable to resolve dependency for ':app@debug/compileClasspath': Cannot convert URL 'com.google.android.gms:play-services-maps:17.0.0' to a file
问题描述
I'm building the Google Maps demo from Android Coding on youtube. I built the app, but for some reason I keep getting the error message
Cannot convert URL 'com.google.android.gms:play-services-maps:17.0.0' to a file.
Here is my 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
}
Can anyone help? EDIT: Copied and pasted the same code twice, here is my actual build.gradle(module: app)**
Here is my 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'
}
解决方案
删除这一行:
//implementation files('com.google.android.gms:play-services-maps:17.0.0')
推荐阅读
- python-3.x - 我的scrapy webscraper 只返回最后的报价
- javascript - 如何检查我的谷歌分析是否正在使用 chrome 扩展程序?
- angular - 由于 IVY 导致的 Angular 8 到 9 升级问题
- c# - C# 中的异常未按预期运行
- vba - 将多个工作簿中的某些单元格 C&P 到 1 个文件中
- html - 在成功的ajax响应中加载模态html
- python-3.x - 根据给定的索引列表访问列表的每个元素 TypeError
- javascript - JavaScript计算器不更新值
- sql - Oracle中删除表后如何删除主键约束
- prometheus - 如何使用 Promql 获取不在另一个时间序列中的时间序列的数据点?