android - Google map not loading data -
i'v set google maps in application, went smooth , without errors, map not loading content. cat log says uses "google play services client version: 4452000" , right after "google play services package version: 5089038" , normal?
this looks like:
fragmentmanager fmanager = getsupportfragmentmanager(); fragment fragment = fmanager.findfragmentbyid(r.id.map_view); supportmapfragment supportmapfragment = (supportmapfragment)fragment; googlemap supportmap = supportmapfragment.getmap(); <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map_view" android:layout_width="match_parent" android:layout_height="400dp" android:name="com.google.android.gms.maps.supportmapfragment"/> i/google maps android api(23503): google play services client version: 4452000 i/dalvikvm(23503): not find method gui.a, referenced method gqh.a w/dalvikvm(23503): vfy: unable resolve static method 24934: lgui;.a (landroid/content/context;)lgrh; d/dalvikvm(23503): vfy: replacing opcode 0x71 @ 0x0003 e/dalvikvm(23503): not find class 'gpq', referenced method gpr.a w/dalvikvm(23503): vfy: unable resolve new-instance 4090 (lgpq;) in lgpr; d/dalvikvm(23503): vfy: replacing opcode 0x22 @ 0x0000 e/dalvikvm(23503): not find class 'gpq', referenced method gpr.a w/dalvikvm(23503): vfy: unable resolve new-instance 4090 (lgpq;) in lgpr; d/dalvikvm(23503): vfy: replacing opcode 0x22 @ 0x0000 e/dalvikvm(23503): not find class 'gpq', referenced method gpr.a w/dalvikvm(23503): vfy: unable resolve new-instance 4090 (lgpq;) in lgpr; d/dalvikvm(23503): vfy: replacing opcode 0x22 @ 0x0000 d/dalvikvm(23503): dexopt: unable opt direct call 0x5ea1 @ 0x0a in lgpr;.a d/dalvikvm(23503): dexopt: unable opt direct call 0x5ea1 @ 0x0c in lgpr;.a d/dalvikvm(23503): dexopt: unable opt direct call 0x5ea1 @ 0x0a in lgpr;.a d/dalvikvm(23503): gc_for_alloc freed 433k, 9% free 19472k/21336k, paused 13ms, total 13ms i/google maps android api(23503): google play services package version: 5089038 w/dalvikvm(23503): vfy: unable resolve static field 20875 (t) in lyo; d/dalvikvm(23503): vfy: replacing opcode 0x62 @ 0x000e w/dalvikvm(23503): vfy: unable resolve static field 20875 (t) in lyo; d/dalvikvm(23503): vfy: replacing opcode 0x62 @ 0x000d d/dalvikvm(23503): gc_for_alloc freed 585k, 8% free 19817k/21336k, paused 13ms, total 13ms i/dalvikvm(23503): failed resolving lcom/google/android/gms/location/internal/parcelablegeofence; interface 4023 'lglm;' w/dalvikvm(23503): link of class 'lcom/google/android/gms/location/internal/parcelablegeofence;' failed e/dalvikvm(23503): not find class 'com.google.android.gms.location.internal.parcelablegeofence', referenced method gls.a w/dalvikvm(23503): vfy: unable resolve check-cast 2086 (lcom/google/android/gms/location/internal/parcelablegeofence;) in lgls; d/dalvikvm(23503): vfy: replacing opcode 0x1f @ 0x0019 d/dalvikvm(23503): gc_for_alloc freed 155k, 4% free 20608k/21336k, paused 13ms, total 14ms v/qcrilmsgtunnelsocket( 1866): after reading offset = 0 remaining = 4 countread = 4 d/qcrilmsgtunnelsocket( 1866): messagelength extracted first 4 inputstream reads = 29 v/qcrilmsgtunnelsocket( 1866): offset = 0 remaining = 29 countread = 0 v/qcrilmsgtunnelsocket( 1866): offset = 0 remaining = 29 countread = 29 d/qcrilmsgtunnelsocket( 1866): readrilmessage: buffer = [b@425f22a0 hexdata = [0100000004040000110000005155414c434f4d4def0308000100000003] v/qcrilmsgtunnelsocket( 1866): read packet: 29 bytes. data available = 32 position = 0 d/qcrilmsgtunnelsocket( 1866): processresponse. message type = 1. data available = 28 d/qcrilmsgtunnelsocket( 1866): bytearray parcel = 5155414c434f4d4def0308000100000003 d/qcrilmsgtunnelsocket( 1866): received ril_unsol_oem_hook_raw message d/qcrilmsgtunnelsocket( 1866): oem id in ril_unsol_oem_hook_raw qualcomm d/qcrilmsgtunnelsocket( 1866): oem id check passed d/qcrilmsgtunnelsocket( 1866): response id in ril_unsol_oem_hook_raw 525295 d/qcrilmsgtunnelsocket( 1866): response id 525295is not served in process. d/qcrilmsgtunnelsocket( 1866): broadcast intent via notifier external apps d/qcrilmsgtunnelifacemanager( 1866): handlemessage what=0 d/qcrilmsgtunnelifacemanager( 1866): broadcasting intent action_unsol_response_oem_hook_raw v/qcrilmsgtunnelsocket( 1866): before reading offset = 0 remaining = 4 countread = 0 i/google maps android api(23503): failed contact google servers. attempt made when connectivity established d/mobiledatastatetracker( 785): default: setpolicydataenable(enabled=true) e/google maps android api(23503): failed load map. error contacting google servers. authentication issue (but due network errors).
you need api key use while testing. different api key generated keystore file.
from eclipse-->windows-->preferences-->android-->build. use sha1 fingerprint , api key google api console , use testing.
don't forget change production 1 before uploading apk google play.
update: use way , works fine. different 1 use:
fragment_map.xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <com.google.android.gms.maps.mapview android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" /> </relativelayout>
this mapfragment class. locate point on map , give title:
public class mapfragment extends fragment { final static string tag = "map"; final static string long = "long"; final static string lat = "lat"; final static string title = "title"; private mapview mmapview; private googlemap mmap; private bundle mbundle; bundle args; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view inflatedview = inflater.inflate(r.layout.fragment_map, container, false); mapsinitializer.initialize(getactivity()); mmapview = (mapview) inflatedview.findviewbyid(r.id.map); mmapview.oncreate(mbundle); setupmapifneeded(inflatedview); return inflatedview; } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mbundle = savedinstancestate; args = getarguments(); } private void setupmapifneeded(view inflatedview) { if (mmap == null) { mmap = ((mapview) inflatedview.findviewbyid(r.id.map)).getmap(); if (mmap != null) { setupmap(); } } } private void setupmap() { mmap.addmarker(new markeroptions().position(new latlng(args.getdouble(lat), args.getdouble(long))).title(args.getstring(title))); mmap.movecamera(cameraupdatefactory.newlatlngzoom(new latlng(args.getdouble(lat), args.getdouble(long)), 15)); } @override public void onresume() { super.onresume(); mmapview.onresume(); } @override public void onpause() { super.onpause(); mmapview.onpause(); } @override public void ondestroy() { mmapview.ondestroy(); super.ondestroy(); } @override public void onstart() { super.onstart(); } }
and how add screen:
mapfragment mapfragment = new mapfragment(); fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction transaction = fragmentmanager.begintransaction(); bundle args = new bundle(); args.putstring(mapfragment.title, title); args.putdouble(mapfragment.long, longitude); args.putdouble(mapfragment.lat, latitude); mapfragment.setarguments(args); transaction.replace(r.id.content_frame, mapfragment,"map"); transaction.addtobackstack(null); transaction.commit();
i hope helps.
Comments
Post a Comment