如何在模拟器上显示地图

Kne*_*ZOD 5 android android-maps-v2 android-studio

在Android Studio中,我创建了一个Map Activity项目。因此,没有自定义代码。

唯一的自定义更改是从google_maps_api.xml _(https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=) _ 复制URL 并使用它来创建API密钥。

Android Studio:3.0.1仿真器:具有API 25的Nexus 5X

Build.gradle文件

应用插件:“ com.android.application”

应用插件:“ kotlin-android”

应用插件:“ kotlin-android-extensions”

android {
    编译版本26
    defaultConfig {
        applicationId“ xxxx.xxx.xxxx”
        minSdkVersion 19
        targetSdkVersion 26
        版本代码1
        versionName“ 1.0”
        testInstrumentationRunner“ android.support.test.runner.AndroidJUnitRunner”
    }
    buildTypes {
        发布 {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        }
    }
}

依赖项{
    实现fileTree(dir:'libs',包括:['* .jar'])
    实现“ org.jetbrains.kotlin:kotlin-stdlib-jre7:$ kotlin_version”
    实施'com.android.support:appcompat-v7:26.1.0'
    实施'com.google.android.gms:play-services-maps:11.0.0'
    testImplementation'junit:junit:4.12'
    androidTestImplementation'com.android.support.test:runner:1.0.1'
    androidTestImplementation'com.android.support.test.espresso:espresso-core:3.0.1'
}

屏幕截图

在此处输入图片说明

好像我在想什么。我只是不知道那是什么。

Mas*_*han 3

尝试在手机中运行。有时模拟器无法正确加载地图,这就是为什么它显示空白地图而不加载根。