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 android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
03-15 14:22:40.465:
W/System.err(2358):     at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
03-15 14:22:40.465: W/System.err(2358):    
at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
03-15 14:22:40.465: W/System.err(2358):    
at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
03-15 14:22:40.465: W/System.err(2358):    
at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
03-15 14:22:40.465: W/System.err(2358):    
at java.lang.Thread.run(Thread.java:856)


10-03 15:54:51.784: WARN/System.err(12994): java.io.IOException: Server returned: 3
10-03 15:54:51.784: WARN/System.err(12994):     at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
10-03 15:54:51.784: WARN/System.err(12994):     at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
10-03 15:54:51.784: WARN/System.err(12994):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
10-03 15:54:51.784: WARN/System.err(12994):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
10-03 15:54:51.784: WARN/System.err(12994):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
10-03 15:54:51.784: WARN/System.err(12994):     at java.lang.Thread.run(Thread.java:1019)
 
 
 
SSolution - 
 
Use two key - debug key and release key
 
 <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock" 
        android:debuggable="false"> 
 
And 
 
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 http://code.google.com/android/maps-api-signup.html - 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:
android:apiKey="@string/production_api_key"
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 -
 
<FrameLayout
            android:id="@+id/mapview_bg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/silver" 
            >

            <com.google.android.maps.MapView
                android:id="@+id/deal_mapview"
                android:layout_width="146dp"
                android:layout_height="106dp"
                android:apiKey="@string/google_map_api_key"
                android:clickable="true" />
       </FrameLayout>
 
 
Sources - google, stack and personal exp