google-play-services-maps:17.0.0即使使用默认项目Android Studio创建也不起作用 [英] google-play-services-maps:17.0.0 is not working even with default project Android Studio created

查看:419
本文介绍了google-play-services-maps:17.0.0即使使用默认项目Android Studio创建也不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我...

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

I want to create a project based on Google Maps. But after building gradle in Android Studio, The following error occurs:

错误:

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

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

When i clicked on the 'Install Repository and ...' then this message appear:

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

Could not find dependency "com.google.android.gms:play-services-maps:17.0.0"

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

NOTE: Gradle work online mode. I went to Setting and Android SDK then downloaded google play services.. but it is not working for me. I also set up a proxy.

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

root gradle:

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

推荐答案

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

After much effort, I was able to solve the problem. Strange as it may seem, the problem was solved by manually adjusting the proxy.

谢谢.

这篇关于google-play-services-maps:17.0.0即使使用默认项目Android Studio创建也不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆