I worked all day yesterday on getting Maps v2 to work on my setup so that I can do a project I want to do that will require maps, but no matter what I did I got an immediate message of "Unfortunately the app has stopped" when I emailed the apk to myself and installed it by clicking it on my phone itself.
Today I tried to use the method of installing the usb driver Samsung provides for using your phone to connect via usb while debugging in Eclipse. The device shows up correctly in the DDMS list and I am able to select it and it shows connected with no warnings or errors. But when I try to run the map test project I put together it just gives a black screen and I can't see any hint of errors or warnings in the console or logcat. I thought it might be my device not showing up correctly in Eclipse, so I tested another simple app project that is basically just a "hellow world" level project and it showed up on my phone correctly.
Just to demonstrate that I have been researching the project I have tried several versions of the following:
1) I have been through the process of generating api key several times
2) I have added the required permissions to my manifest
3) I have added the tag just above the tag with the maps info and my api key
4) I have tried 3 or 4 different example map apps from textbooks and online tutorials I found and all give the same result.
The most I have gotten to happen so far was to get a screen for the google map to show up but it just had a grid and no map (I thought that was due to bad key so I created a new one but it then went back to sorry app stopped message). But now when I try the debug with device plugged in via usb approach I get just a black screen.
(added as ps.) I do have a related question that involves the keystores in Eclipse. When I first started yesterday I would use the manifest xml page's Export Wizard to export an apk file using a keystore I have previously created. It caught my attention that in the file screen when it has you pick a file name for the apk file it would display the key value connected with the apk's certificate. This was different then the debug key value that shows up when you use the keytool tool or when you look under Window/Preferences/Android. I took this additional key value and added it to the allowed devices for the apikey in my google api console. But it did not help. Any thoughts on this? thanks. (Since I am now using my device directly connected via usb to debug this should not now be a factor but was curious to understand this).
(addes as ps.) One thing I have noticed in the different examples I have tried is that one of them had me add to the manifest inside tag but none of the other examples did. curious to hear thoughts on that
Any help would be appreciated. I feel like I have exhausted my ability to figure this out.
Thanks
I was able to figure out my issue by doing something similar to Chris Stratton's comment. I added the following code that I found on the google android pages and it prints out in the logcat the correct key value and I was then able to figure out my issues from there:
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo("com.mycompany.mypackage",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}