gpt4 book ai didi

android - google-play-services-maps:17.0.0即使使用默认项目Android Studio创建也不起作用

转载 作者:行者123 更新时间:2023-12-03 05:25:43 24 4
gpt4 key购买 nike

请帮我...

我想创建一个基于Google Maps的项目。但是在Android Studio中构建gradle之后,会发生以下错误:

错误:

Failed to resolve: com.google.android.gms:play-services-maps:17.0.0
Install Repository and sync project
Show in Project Structure dialog
Affected Modules: app

当我单击“安装存储库并...”时,出现此消息:

找不到依赖项“com.google.android.gms:play-services-maps:17.0.0”

注意:
Gradle 工作在线模式。
我去了Setting and Android SDK然后下载了Google Play服务..但是它对我不起作用。
我还设置了代理。

编辑:
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myapplication"
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

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

buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()

}
}

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

最佳答案

经过大量的努力,我得以解决问题。
看起来很奇怪,问题是通过手动调整代理解决的。

谢谢大家

关于android - google-play-services-maps:17.0.0即使使用默认项目Android Studio创建也不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61356897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com