Friday, March 15, 2013

Android and strange error with maps from google

If you getting below error -

 03-15 14:22:40.464: W/System.err(2358):     at
03-15 14:22:40.465:
W/System.err(2358):     at$MapTileRequest.readResponseData(
03-15 14:22:40.465: W/System.err(2358):    
03-15 14:22:40.465: W/System.err(2358):    
03-15 14:22:40.465: W/System.err(2358):    
03-15 14:22:40.465: W/System.err(2358):    

10-03 15:54:51.784: WARN/System.err(12994): Server returned: 3
10-03 15:54:51.784: WARN/System.err(12994):     at
10-03 15:54:51.784: WARN/System.err(12994):     at$MapTileRequest.readResponseData(
10-03 15:54:51.784: WARN/System.err(12994):     at
10-03 15:54:51.784: WARN/System.err(12994):     at
10-03 15:54:51.784: WARN/System.err(12994):     at$
10-03 15:54:51.784: WARN/System.err(12994):     at
SSolution - 
Use two key - debug key and release key
Follow below steps - 
You can't use debug.keystore to create a Google Maps API key for applications going into the market. If you already have the application (or indeed any application) in the market then you already have the keystore you should use. This is how you use this keystore to get a Google Maps API key:
Step 1: At the command line navigate to the directory with your keystore file in it:
cd <keystore-dir>
Step 2: Now list the contents of your keystore:
keytool -list -keystore <your-keystore-file>
Step 3: Enter the password for your keystore when prompted. Keytool will now display a list of certificates and their MD5s.
Step 4: Copy the MD5 for the certificate you are going to use to sign your application into your copy/paste buffer.
Step 5: Open a browser and navigate to - if you're not logged in with your Android Market account, you'll need to do that next, before you generate your API key.
Step 6: Paste the MD5 from your copy/paste buffer into the text box labelled "My certificate's MD5 fingerprint:" and tick the "I have read and agreed..." box.
Step 7: Click 'Generate API Key'. You'll now see the API key you need to use.
Step 8: Copy and paste the API key into your MapView component's android:apiKey property.
If you have multiple MapView components then you can declare a string resource:
<string name="production_api_key">thisIsMyKeyValue</string>
Now you can use this in your android:apiKey property in the same way that you reference any other string value:
Now export the application to an APK file using the certificate you used in step 4.
Provided you follow this step-by-step guide you should be OK - I've just myself started using a maps API key generated in this way.
Things to watch out for:
  • Using the MD5 of the keystore file (md5 <my-keystore-file>), not of the certificate. Its the MD5 of the certificate you need.
  • Being logged in to Google when you generate the API key, but with the wrong account. Your maps API key and your Android Market signing key must belong to the same Google account.
If you are using FrameLayout then -

                android:clickable="true" />
Sources - google, stack and personal exp