HardCodeStuds
HardCodeStuds

Reputation: 539

Android google maps not showing the actual map

A little bit of context:

Since several weeks ago I'm doing some stuff with google maps api for Android, a week ago I had to reset my PC and after that I cloned my Android project from my private repository. Now, the google maps part of the project won't work, when I start the map activity, it shows the layout as expected but the map is not rendered, I only see the Google logo at the bottom left corner.

I have checked the following:

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
        android:layout_height="fill_parent" android:id="@+id/map"
        tools:context="co.com.wayfit.activities.RouteActivity"
        android:name="com.google.android.gms.maps.SupportMapFragment" />

And this is my gradle file

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
signingConfigs {
    release {
        storeFile file('C:/ProjectDir/app/wayfit.keystore')
        storePassword "wayfit"
        keyAlias "wayfit"
        keyPassword "wayfit"
    }
}
defaultConfig {
    applicationId "co.com.wayfit"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    signingConfig signingConfigs.release
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}
productFlavors {
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

EDIT:

I think my problem is due to the API KEY. I tried deleting the activity and creating a new map activity, android studio generated a file for me named google_maps_api.xml and it said You can also add your credentials to an existing key, using this line: D6:76:DA:B5:##:##:##:##:##:##:##:##:##:##:##:##:##;co.com.something.activities

so I thought to use that for my api credentials, however when I run the command prompt "keytool -v -list -keystore mykeystore.keystore" which is the same I'm using to sign the apk, I'm receiving another different SHA1

D8:B2:29:2C:C5:##:##:##:##:##:##:##:##

I used both in the same API KEY under the same packages on the developers console.

Another thing that bugs me is google_maps_api.xml says (debug) at the right side of the name, does this influence something?

Upvotes: 0

Views: 1473

Answers (2)

mDonmez
mDonmez

Reputation: 400

The API_KEY for debug was stored app\src\debug\res\values\google_maps_api.xml

Putting the API_KEY for release to google_maps_api.xml file by the folder app\src\release\res\values works for me as mentioned this answer..

https://stackoverflow.com/a/42123330/2796625

Upvotes: 0

Access Denied
Access Denied

Reputation: 9461

  • Check if your devices' date & time settings correspond to your current time zone (Unfortunately the log output will not return much constructive information to lead you to think about the date & time)
  • Check if you've enabled the correct service in your API console (Enable Google Maps API Android V2 not Google Maps API V2, log will return Authentication Failed if you do something wrong with this step)
  • Check if you've used the correct keystore to get the API secret (The log will give you a hint saying Authentication Failed
  • Check if you've included the correct library files

More info can be found in tons of others questions regarding blank google maps: https://stackoverflow.com/a/15636254/1099716

Upvotes: 1

Related Questions