Issue
When using the MapView from the latest google maps API, I am getting a memory leak because MapView is holding onto my activity.
I used Leak Canary and have this trace
D/LeakCanary﹕ * GC ROOT com.google.android.gms.location.internal.t.a
D/LeakCanary﹕ * references com.google.android.gms.location.internal.s.a
D/LeakCanary﹕ * references com.google.maps.api.android.lib6.d.v.c
D/LeakCanary﹕ * references com.google.maps.api.android.lib6.d.aj.b
D/LeakCanary﹕ * references com.google.maps.api.android.lib6.gmm6.c.p.a
D/LeakCanary﹕ * references com.google.maps.api.android.lib6.gmm6.c.y.mParent
D/LeakCanary﹕ * references android.widget.FrameLayout.mParent
D/LeakCanary﹕ * references com.google.android.gms.maps.MapView.mContext
D/LeakCanary﹕ * leaks com.myapp.activities.main.AttractionDetailActivity instance
Has anyone seen this before?
Solution
Check if you are calling googleMap.setMyLocationEnabled(true)
in your onMapReady() callback.
If you are then you should call googleMap.setMyLocationEnabled(false)
in your onDestroy.
Answered By - Chaits
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.