Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display Map on emulator

From Android Studio, I created a Map Activity project; so, there's no custom code.

The only custom changes made was copying the URL from the google_maps_api.xml _(https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=)_ and using it to create an API key.

Android Studio: 3.0.1 Emulator: Nexus 5X with API 25

Build.gradle file


apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "xxxx.xxx.xxxx"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation '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'
}

Screenshot

enter image description here

It seems like I'm missing something; I just don't know what it is.

like image 494
Kneel-Before-ZOD Avatar asked Jan 29 '18 06:01

Kneel-Before-ZOD


People also ask

How do I see apps on my emulator?

Run your app on the emulator After you have created an Android Virtual Device (AVD), you can start the Android Emulator and run an app in your project: In the toolbar, select the AVD that you want to run your app on from the target device drop-down menu. Click Run.

How do I turn on location on emulator?

First, run your Android Emulator and click on the three dots on the menus beside. On the left pane, select Location and change the coordinates according to your location. Press the Send button, changes will immediately take effect.

How do I change the screen size on my emulator?

Type "cd\" (to move to the main directory). Now type "telnet localhost 5554" (leaving the quotes and the number is the same as present on top of your emulator). Now type : window scale 0. x (x as per your requirement eg: window scale 0.5 to get the half screen size).

How do I make Android Emulator full screen?

Alt+Enter is the keyboard shortcut to toggle full screen mode in the emulator, just do it again to exit full screen.


1 Answers

Try to run in your mobile. Sometimes emulator is not able to load map properly, That's why it shows blank map without loading roots.

like image 105
MashukKhan Avatar answered Oct 05 '22 03:10

MashukKhan