0

Google map is still blink and does not load. All the scripts, api key and code are correct.

The app gradle file is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.muzammil.bustracking"
        minSdkVersion 15
        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 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.android.gms:play-services-location:+'
    implementation 'com.google.android.gms:play-services-maps:+'
    implementation 'com.google.firebase:firebase-core:+'
    implementation 'com.google.firebase:firebase-auth:+'

    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-messaging:+'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support:design:26.1.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//    apply plugin: 'com.google.gms.google-services'
}

apply plugin: 'com.google.gms.google-services'

I am running app on actual Android phone , not emulator.

A lot of Thanks in advance for the answer...

coder
  • 8,346
  • 16
  • 39
  • 53

4 Answers4

1

I finally came to a solution.

Actually I was running the app on Android device with API level 24, while the app was using API level 26. I changed the target SDK version from 26 to 24 from File > Project Structure > app > flavors, at it worked.

Thank you to everybody helped! I really appreciated.

0

I think that you are using wrong API key.Not displaying usually happens because of it.

This guide is a quick start to adding a map to an Android app

Muhammad Usman Ghani
  • 1,279
  • 13
  • 19
0

Try

<uses-library android:name="org.apache.http.legacy" android:required="false" />

In manifest for it to work under the application> tag

NoobAndroid
  • 86
  • 4
  • 10
0

Ensure that you have mentioned below permission in androidmanifest.xml

<uses-permission android:name="android.permission.INTERNET" /> 

You must have API key in your project. The key can be obtained from this link. Also you have to enable API from GCP itself. This requires SHA key for your machine which can be generated using android studio.

Sushant Somani
  • 1,450
  • 3
  • 13
  • 31
  • all these things are well sir! while debugging it takes me to 'looper.java' class and show this message "byte code does not match the source code" – Muzzammil Hussain Jul 21 '18 at 18:58