【问题标题】:google-play-services-maps:17.0.0 is not working even with default project Android Studio createdgoogle-play-services-maps:17.0.0 即使使用创建的默认项目 Android Studio 也无法正常工作
【发布时间】:2020-04-21 03:16:10
【问题描述】:

请帮帮我...

我想创建一个基于 Google 地图的项目。但是在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 在线工作模式。 我去了设置和Android SDK,然后下载了谷歌播放服务..但它不适合我。 我也设置了代理。

编辑:

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'
}

根等级:

// 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
}

【问题讨论】:

  • 添加你的 build.gradle 代码
  • @Android_id 完成了。

标签: android google-maps


【解决方案1】:

经过一番努力,我终于解决了这个问题。 看起来很奇怪,通过手动调整代理解决了这个问题。

谢谢大家。

【讨论】:

  • 我建议为社区详细说明一下。谢谢!
  • @karandhillon 当然。一开始我从 SDK 工具下载了谷歌播放服务,然后我同步 Gradle,但它没有成功并且无法解决这种依赖关系。我试图通过单击链接来安装它,但它不起作用。我终于设置了手动代理配置并成功了。注意:自动检测代理可能不起作用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多