Reputation: 298
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...
Upvotes: 0
Views: 166
Reputation: 298
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.
Upvotes: 1
Reputation: 1510
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.
Upvotes: 0
Reputation: 96
Try
<uses-library android:name="org.apache.http.legacy" android:required="false" />
In manifest for it to work under the application> tag
Upvotes: 0
Reputation: 1279
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
Upvotes: 0