How to run the google map sample v2? - android

I am writing an android apps which require the use of Google Map.
I use Eclipse and have downloaded the SDK.
I then import the Google Play Service and the maps sample inside
and Eclipse have successfully compile and run in an emulator.
However, while running, it didn't work!!
It closed the apps after a few second on the main page, and none of the fragments(objectS)
were shown...
I have not change anything except adding android.support-v4.jar
and change meta-data in manifest for my Google key.
I have tried to:
run on emulator and real device(Samsung S2 LTE)
use both registered certificate and debug certificate, and have asked for API access on Google to get a key
use different versions of Eclipse: Kepler, Helios and the one downloaded from developer
But none of them work.
Does anybody know what's happening? What shall I do to fix it?
Thanks

This Worked for me
1) Install Google map APIs. This can be done in Eclispe
Windows/Android SDK and AVD Manager -> Available Packages -> Third
Party Add-ons -> Google Inc. -> Google APIs by Google Inc., Android
API X
2) From command line create new AVD. This can be done by listing
targets (android list targets), then android create avd -n
new_avd_api_233 -t "Google Inc.:Google APIs:X"
3) Then create AVD in Eclipse Windows/Android SDK and AVD Manager ->
New... -> (Name: new_avd_X, Target: Google APIs (Google Inc.) - API
Level X)
4) Create Android Project in Eclipse File/New/Android Project and
select Google APIs Build Target.
5) add between tags.
5) Run Project as Android Application.

I think you must have followed all these steps to import the Google play services library project and its map samples which are given in this url :-
https://developers.google.com/maps/documentation/android/intro
If you have correctly imported the project and library by following above steps and still your map is not working then it may be because of the reason that the google play service are not working on your device on which you are running tha samples. You have to reboot your device so that the google services start working.

Related

Google play services problems in emulator [duplicate]

For the emulator I have below, I am getting the error message that "Google Play Services not installed on the device".
As per the developer site, it says that 'The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
Not able to understand if the emulator is running 4.4.2 then why is google play services not present?
Some related threads, but no resolution. (adding these just to point out this issue is not a duplicate):
Related Thread
Related Thread
http://developer.android.com/google/play-services/setup.html
Quoting docs
If you want to test your app on the emulator, expand the directory for
Android 4.2.2 (API 17) or a higher version, select Google APIs, and
install it. Then create a new AVD with Google APIs as the platform
target.
Needs Emulator of Google API"S
See the target in the snap
Snap
I prefer testing on a real device which has google play services installed
You will not able to test the app using the Google-Play-Service library in emulator. In order to test that app in emulator you need to install some system framework in your emulator to make it work.
https://stackoverflow.com/a/11213598/1405008
Refer the above answer to install Google play service on your emulator.
If you happen to not have the image, download it via the SDK manager:
If you're using Xamarin, I found a guide on their official forum explaining how to do this:
Download the package from the internet. There are many sources for this, one possible source is the CyanogenMod web site.
Start up the Android Player and unlock it.
Drag and drop the zip file that you downloaded onto the Android Player.
Restart the Android Player.
Hereafter, you might also need to update the Google Play Services from the Google Play Store.
Hope this helps for anyone else who has troubles finding the documentation.
Setp 1 :
Download the following apk files.
1)com.google.android.gms.apk (https://androidfilehost.com/?fid=95916177934534438)
2)com.android.vending-4.4.22.apk (https://androidfilehost.com/?fid=23203820527945795)
Step 2 : Create a new AVD without the google API's
Step 3 : Run the AVD (Start the emulator)
Step 4 : Install the downloaded apks using adb .
1)adb install com.google.android.gms-6.7.76_\(1745988-038\)-6776038-minAPI9.apk
2)adb install com.android.vending-4.4.22.apk
adb come up with android sdks/studio
Step 5 : Create the application in google developer console
Step 6 : Configure the api key in your Androidmanifest.xml and google api version.
Note :
In step1 you need to download the apk based on your Android API level(..18,19,21..) and google play services version (5,5.1,6,6.5......)
This will work 100%.
google play service is just a library to create application but in order to use application that use google play service library , you need to install google play in your emulator.and for that it need the unique device id. and device id is only on the real device not have on emulator. so for testing it , you need real android device.

Google Play Services Missing in Emulator (Android 4.4.2)

For the emulator I have below, I am getting the error message that "Google Play Services not installed on the device".
As per the developer site, it says that 'The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
Not able to understand if the emulator is running 4.4.2 then why is google play services not present?
Some related threads, but no resolution. (adding these just to point out this issue is not a duplicate):
Related Thread
Related Thread
http://developer.android.com/google/play-services/setup.html
Quoting docs
If you want to test your app on the emulator, expand the directory for
Android 4.2.2 (API 17) or a higher version, select Google APIs, and
install it. Then create a new AVD with Google APIs as the platform
target.
Needs Emulator of Google API"S
See the target in the snap
Snap
I prefer testing on a real device which has google play services installed
You will not able to test the app using the Google-Play-Service library in emulator. In order to test that app in emulator you need to install some system framework in your emulator to make it work.
https://stackoverflow.com/a/11213598/1405008
Refer the above answer to install Google play service on your emulator.
If you happen to not have the image, download it via the SDK manager:
If you're using Xamarin, I found a guide on their official forum explaining how to do this:
Download the package from the internet. There are many sources for this, one possible source is the CyanogenMod web site.
Start up the Android Player and unlock it.
Drag and drop the zip file that you downloaded onto the Android Player.
Restart the Android Player.
Hereafter, you might also need to update the Google Play Services from the Google Play Store.
Hope this helps for anyone else who has troubles finding the documentation.
Setp 1 :
Download the following apk files.
1)com.google.android.gms.apk (https://androidfilehost.com/?fid=95916177934534438)
2)com.android.vending-4.4.22.apk (https://androidfilehost.com/?fid=23203820527945795)
Step 2 : Create a new AVD without the google API's
Step 3 : Run the AVD (Start the emulator)
Step 4 : Install the downloaded apks using adb .
1)adb install com.google.android.gms-6.7.76_\(1745988-038\)-6776038-minAPI9.apk
2)adb install com.android.vending-4.4.22.apk
adb come up with android sdks/studio
Step 5 : Create the application in google developer console
Step 6 : Configure the api key in your Androidmanifest.xml and google api version.
Note :
In step1 you need to download the apk based on your Android API level(..18,19,21..) and google play services version (5,5.1,6,6.5......)
This will work 100%.
google play service is just a library to create application but in order to use application that use google play service library , you need to install google play in your emulator.and for that it need the unique device id. and device id is only on the real device not have on emulator. so for testing it , you need real android device.

Map not getting in emulator android api v2

I want to install my map application in emulator it installed fine but not getting map on it,showing error in log cat like Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above, but I am Just seeing zoom buttons and all other UI. What i have to do to get map in emulator in android API v2.
I followed this link: Running Google Maps v2 on the Android emulator
I got finally map in my emulator. I followed these steps to achieve it.
Create avd and start emulator
Go to platform tools path present in Android SDK and put these apk's in it.
Install com.android.vending.apk (Google Play Store, v.3.10.9)
Install com.google.android.gms.apk (Google Play Service, v.2.0.12)
Install these apk's one by one by going to platform tools path by using command prompt(shift+Right click-->open command window here).Follow these commands
adb devices
adb install com.android.vending.apk
adb install com.google.android.gms.apk
Import google-play-services_lib project which is present at project location and add it to your project.(path of lib project:D:\Softwares\android-sdk\extras\google\google_play_services\libproject)
Restart emulator and clean your project and run it through emulator.
That's it. :)
Google Maps API V2 require Google Play Services, which can be downloaded from Play Store, but since emulator doesn't have access to Play store, you cant get Play Services there and in turn the maps. At the moment, referencing the Google Android Map Api v2 you can't run google maps v2 on Android emulator; you must use a device for your tests.
People seem to have trouble with the build in emulator and google maps. As an alternative, you could try this 3rd party emulator. People seem to have better luck with it and google maps. And it's supposed to be faster.
http://www.genymotion.com/
After three days of reading tons and tons of tutorial on how to do this, this is the UP-TO-DATE solution with the UP-TO-DATE files and EASIEST steps to follow.
Steps. 1. Install genymotion emulator (This is way much faster than the eclipse emulator). All about it is easier. Research on how to start it.
Download these three apk's ()
Go to the platform tools folder of your adt bundle instalation folder (your_root_to_your_sdk\sdk\platform-tools). Open the sdk folder and there is the platform tools folder.
Paste the downloaded apks to the platform tools folder
Press Shit and right click the mouse, then press "Open command windows here"
In the cmd type adb devices and hit enter. Then your will use "adb install name_of_the_each_apk" for each of the three apks.
Open the google play and enter your account, and follow the steps: next, install google play services, open maps, and so on, they will guide you. That's all.
AS SIMPLE AS THAT.

Google Authorization Failure Error

I am using Android 2.3.6 Device for testing. When I run the Google Map android api v2 on the device it doesnot show the map on the device and also show the error on logcat as follows
Google Maps Android API Authorization failure.
Also on the Console It shows the
[2012-12-07 13:59:42 - google-play-services_lib] Could not find google-play-services_lib.apk!
Please Help Me!!!!!!!!
I also found that the play services libproject has to be imported onto the same physical drive as your project. (which may not be the case if you didn't check the 'Copy projects into workspace' checkbox)
Setting up a Library Project
I just added the project of google services and added a reference in my project property->Android
check above link.
First of all download the latest google play services revision 3.
Import the google play services libproject as a library in Eclipse.
Then go to properties>Android and below add the above project as a library to your project.
Also ensure that the google play services are updated on your device.Use the debug keystore if you are directly running the app on the device.You will have to add the sha1 print and package of the debug keystore while creating Android key.
Refer to this example :
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw
Unfortunately for using the Google Maps you have to test the application on a real device as the emulator is not supported.

Android Google Map Addon not available?

i am trying to display google map on Android refering to this tutorial
http://developer.android.com/resources/tutorials/views/hello-mapview.html
when i go to google website to download addon it says addons are not available kindly guide what should i do to achieve this??
If you read the Add-on page more carefully you'll see this:
The Google APIs add-on is not yet available for download. For your convenience, the Google APIs add-on is available preinstalled in the Android SDK.
So you should already have the Google APIs add-on already if you've installed the Android SDK.
To check, run the android command with no options at a command prompt to open the Android SDK and AVD Manager GUI. Check Installed Packages to confirm that Google APIs is listed:
If it's not listed use the Available Packages option to install it.
If you're using Eclipse, you also need to edit the Properties of your Project and select the correct Build Target:

Categories

Resources