How can I show GoogleMap v2 on Android - java

I tried to show GoogleMap v2 in my Android application,but it failed.
Application didn't exit but I can't see GoogleMap on display as following image.
I got API key and set it in Android Manifest, and I did other settings for using GoogleMap v2.
For example, I added 7 permissions, 1 users-feature, 2 meta-data in Manifest.
Now I did nothing in MainActivity.java.(Just try to show main view.)
Is something missing for using it?
Is there anyone who has experience like this?
Please teach me how.
And I compiled it by Google API[Android 4.2.2]
Image URL : https://dl.dropboxusercontent.com/u/88565794/2014-02-07%2023.15.21.png

Have a look at this blog post, that describes almost the same problem:
http://android-er.blogspot.nl/2012/12/google-maps-android-api-v2-with-blank.html
If you use Google Maps Android API v2, but with a blank (gray) map displayed, and "E/Google Maps Android API(12676): Authorization failure" reported in LogCat; may be caused by a wrong API Key assigned.
In order to use Maps Android API, you have to assign a API Key in AndroidManifest.xml.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your API Key here"/>
But there are many more sources availble that describe a similar problem: https://www.google.co.uk/search?q=google+maps+v2+blank+map&client=safari
Ofcourse I can't tell you what you did wrong, but I would suggest you take a tutorail like this one:
http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/ It even provides some how-to's on customization.
Or have a look at the documentation: https://developers.google.com/maps/documentation/android/start

Are you installing the app to your device from a different computer than the one you generated the debug key from? If so, you would need to add that debug key as well to you developer console settings.
I had this issue, maybe you're having the same issue.

Related

Google Map is not displayed after I submitted my app to the Play store

After I submitted my app to play store I noticed that map is not shown, I also noticed this problem is some how common; I tried all possible solutions but none of them have worked for me, the blank map is always displayed after I install/update my app, in some cases I managed to display map in release-apk, I still face the same proplem after I download my app from play store, notice that when map is displayed in release version, it does not display in debug version; some of these solutions are
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="#string/google_maps_key"/>
and
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
I placed both tags inside application tag and outside application tag in manifest file, still not working.
I used SHA1 key that was generated by android studio and the another one generated me using file.keystore, still not working, I tired different api keys for debug and release apk in google_map_api.xml still not working; I don't know what else I should try.
thanks in advance
When you want to upload the app to google play, you must change the HASH KEY and upload.

Show blank google maps in codename one

I'm building a codename one mobile application and i need to fetch a blank google maps on which i can place icons showing my own coordinates (not places i can fetch through the google places api). How can i do that ? Since i don't want to fetch anything other than a blank map, i wonder if i need a webservice for that. I have read that instantiating the MapContainer would show me a blank google map but i am stil getting a osm map (on both the emulator and a real Android 4.4 device). I have already done all the procedures required to get a key and all the steps of the maps demo work fine for me. Now what i need to know is how to be able to get a blank map.
Thank you advance for the answers.
You get OSM on the device as a fallback when initializing the native map failed. Make sure you followed the integration instructions as explained here.
You can debug the issue on an Android device by connecting the device with a cable and launching the DDMS tool from the Android command line SDK. In 90% of the cases this means your SHA1 is different from the one defined in the maps API and this will be printed when you try to open the map.
On the simulator OSM is shown unless you provided the Google maps provider in the constructor.

Facebook SDK crashes google-play-services-lib if imported as existing Android source code

I have an extremely strange problem to which finding solution seems to be very tricky. Here's the story:
The application I'm working on uses both Facebook SDK and Google Maps v2. Team mate was working on Google Maps and I was working on Facebook part. When we combine his and mine code it appears that just having FacebookSDK as an imported project in the workspace (not even referenced in Properties|Android|Library section of our app) , straight away makes the app not see the Google Maps library. The work around is to add Google Maps into Java build path, however the application still crashes when we try to access the activity based on Google Maps. Not having Facebook SDK in the workspace makes the Google Maps work. When the app is ran with Google Maps added to the Java build Path, when trying to access the Google Maps activity LogCat shows NoClassDefFoundError exception.
Hope I explained the problem well. If not then let me know what more is required to get closer to fixing this strange problem. Thanks :)
SOLUTION: It seems that adding Java Build Path reference to android_sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google_play_services.jar file fixed the issue. Crysis averted. ;)

Google map on android only shows grid.

I have a problem where my map activity only shows the grid and is not downloading map tiles.
What I've checked:
I have the api key that I got from here.
I've added the reference to my android manifest.
My device has internet (and google maps works on the device).
In LogCat I am getting the following messages from MapActivity
07-28 20:25:19.271: INFO/MapActivity(550): Handling network change notification:CONNECTED
07-28 20:25:19.271: ERROR/MapActivity(550): Couldn't get connection factory client
What am I missing? How can check to see that my key is the problem?
You have to add a Debug key:
http://code.google.com/android/add-ons/google-apis/mapkey.html#getdebugfingerprint
That's indeed really annoying as you have 2 different keys to handle and switch.. ( and sometimes forget to make an update on the Market with your debug key!)
The issue was that I placed the "android.permission.INTERNET" line inside the "application" area of the Manifest file.

Using maps from Google

I'm trying to develop an application using Google's maps and I can't get this application to work. I have done all what is described in the tutorial of the "MapView" sample code, including getting a map key associated to the MD5 signature of my "debug.keystore" file but the emulator definitively says that the application has stopped unexpectedly.
This error message appears when I try to process the setContentView line of code.
The only point where I am not sure of doing what must be done is about the signature of my application : as far as I have understood the signing process of an application, in debug mode, there is nothing to do. Is it correct?
I develop in Java using the Netbeans IDE.
Thanks for the time you will spend trying to help me.
First off, I'd recommend you very much to switch to Eclipse where the official Android plugin is available which will actually give you the LogCat (that's phone-side console) and you will always know what's wrong when something doesn't work. I'm not so sure that the plugin for NetBeans works equally well.
Secondly, regarding your crash, it has nothing to do with the API Key (if the key was wrong, you would see an empty map). Two things here from the top of my mind:
the Android version you need is the
"Google APIs", not vanilla "Android"
you didn't mention that Map library in the Manifest
So make sure that the library used with your project is "Google APIs" (of desired version, I'd stick with 2.1 or 2.2) and that there's this line in the Manifest file
<application ...>
...
<uses-library android:name="com.google.android.maps" />
</application>
Other than that, would be awesome to see some stack trace to be 100% sure.

Categories

Resources