Reputation: 491
I am using the map functionality in my app.Whenever I run map in my app I got error i.e.
04-19 11:03:50.274: E/Google Maps Android API(23366): Failed to load map. Could not contact Google servers.
I have checked manifest file and code all is correct.And Google play service is also working in my android device. I am running sample code of map same error I have got.But I am not understanding what is exact problem.Please suggest me how to fix that problem. `
Upvotes: 0
Views: 1982
Reputation: 7936
Have you adquire your map-key in Google Api Console using the package name of your project and your SH1 of the Keytore? If not, go to console and do it ;) You have to put this key in your Manifest, and the permissions required.
Normally this error happens when:
===============Mini tutorial=====================
Ex: 48:+4: ... :46;com.xxxx.xxx.xxx
To know your sha1 you have to open a CMD and do:
C:\>cd C:\Users\YOURUSER\.android\
C:\Users\YOURUSER\.android>"C:\Program Files\Java\jdkXXXX\bin\keytool.exe" -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android
XXX Means the version you have
Now you got your api key go to your Manifest have to put:
... ...
Select the project, right click, go to "File/Import/Android/Existing Android Code into Workspace". In the root directory go to "<-sdk-android folder> /extras/google/google_play_services/libproject/google-play-services_lib"
and select the project that appears. Click Finish.
Right click on project go to "Properties/Android"; click on "Add.." button, and choose google play services and click on OK
Add android-support-v4.jar
to your project if isn't yet.
THe layout of the map is:
And the activity that contains the map has to extend FragmentActivity (Something like this)
public class MainActivity extends android.support.v4.app.FragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
...
}
AAAAND thats all!
Upvotes: 2
Reputation: 10325
Have you generated an api key for your app, using your keystore and package name?
Upvotes: 0