Google Map Android Api V2 Sample Code not working

后端 未结 8 1462
生来不讨喜
生来不讨喜 2020-12-09 11:19

I had tried to use the Google Map Sample Code before which was provided in Google_Play_SERVICE/SAMPLE by using all the available options and it showed the below

相关标签:
8条回答
  • 2020-12-09 11:46

    A common reason for this is not registering the correct keys in your Google API console. Specifically, if you are launching directly from Eclipse, your app is not being signed with your release key, but instead with your debug key. Make sure you register both key fingerprints + package names in your console. It helps to check you have your package names correct, too.

    Here is a link to how to find your debug certificate fingerprint. Look under the section 'Displaying the debug certificate fingerprint'

    0 讨论(0)
  • 2020-12-09 11:48

    Please check..

    1. check if the "libs" folder containing the "android-support-v4.jar" exists in your project.

      "android-support-v4.jar" is located in "/extras/android/compatibility/v4/android-support-v4.jar" under your "android-sdk" drectory.

    2. Before running your project, you must set your project Build target to "Google APIs", not Android x.x. version : Select your project and click Project > Properties > Project Build Target in Eclipse and select any "Google APIs ", and then run your project on your phone. If you use the emulator, also MUST set the AVD of the emulator to the any "Google APIs ".

    3. Once more, you don't need to create the new Google Maps API key in order to test your project, Just use the default provided API key, which is shown as "Key for browser apps (with referers) "in your Google APIs Console.

    4. Finally, the most important is to add Google Play services as an Android library project as follows:

      Select File > Import > Android > Existing Android Code Into Workspace and click Next. Select Browse..., enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Finish.

    0 讨论(0)
  • 2020-12-09 11:49

    Got this problem because I had restriction enabled for my API key in Google Console.

    Make sure it is set to none and then try again

    0 讨论(0)
  • 2020-12-09 11:55

    Please use the Browser key when you download and run the sample project from the internet. Android key will not work in that case and will give this error.

    "Could not contact to server. Authorization Failed"

    Go to your API Console and get your browser key

    Thanks

    Let me know if you have any queries regarding Google Maps Api V2

    0 讨论(0)
  • 2020-12-09 11:56

    I figured out the issue that was with registering the application certificate.

    What we tried was that we sign the application with our own keystore & alias. But here we exactly need to use the debug.keystore which is already available in SDK.

    0 讨论(0)
  • 2020-12-09 11:56

    In that case api key not correct then the google map not showing so follow answer.

    Put the below Meta data in android Menifest file first.

     <meta-data
        android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
     <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyAU9ShujnIg3IDQxtPrafaf7Q1qOvFVdwNmWc4" />
    

    And then put the right Api key in menifest file.

    0 讨论(0)
提交回复
热议问题