Out Of Memory GroundOverlay Map Android

时间:2015-11-03 14:48:11

标签: android google-maps bitmap out-of-memory gmsgroundoverlay

我有问题!

我已使用以下代码在地图上添加了GraundOverlay:

final LatLng NEWARK = new LatLng(40.775067, 14.789154);
    final GroundOverlayOptions auleP = new GroundOverlayOptions();
    auleP.image(BitmapDescriptorFactory.fromResource(R.drawable.piano0p))
            .transparency(0.7f)
            .bearing(60)
            .position(NEWARK, 38f, 38f);

    over = mMap.addGroundOverlay(auleP);

Android KitKat中的这段代码可以解决问题但是如果我在Android Lollipop上运行这个chash whit OutOfMemory错误,可以在这个Logcat中看到

java.lang.OutOfMemoryError: Failed to allocate a 16777228 byte allocation with 2655368 free bytes and 2MB until OOM 
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at android.graphics.Bitmap.nativeCreate(Native Method)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at android.graphics.Bitmap.createBitmap(Bitmap.java:831)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at android.graphics.Bitmap.createBitmap(Bitmap.java:775)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.c.i.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.c.l.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.c.l.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.c.j.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.c.r.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.l.a(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.l.b(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.cj.g(Unknown Source)
11-03 14:30:30.771 30020-30093/uninsideproject.com.uninside2 E/AndroidRuntime:     at com.google.maps.api.android.lib6.gmm6.n.cj.run(Unknown Source)`

我能以什么方式解决这个问题?

请帮帮我

0 个答案:

没有答案