片段上的osmdroid会导致内存不足

时间:2015-09-04 08:59:30

标签: memory fragment osmdroid

我'尝试使用Android Studio在Android上开发地图应用程序。 经过一些操作后,我面临着内存不足的异常...

我有一个抽屉活动,可以在两个片段之间切换:

void StartFragment(int position)
    {
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        Fragment newFragment = null;
        switch(position){
            case(1):
                newFragment = new MissionFragment();
                transaction.replace(R.id.frame_container, newFragment);
                break;
            case(0):
            default:
                newFragment = new MapFragment();
                transaction.replace(R.id.frame_container, newFragment);
                break;
        }
        if (newFragment != null) {
            transaction.addToBackStack(null);
            transaction.commit();
            mCurrentFragment = position;
        }

    }

地图片段的构造如下:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        // Inflate the layout for this fragment
        LinearLayout rl = (LinearLayout) inflater.inflate(R.layout.fragment_map, container, false);
        map = (MapView) rl.findViewById(R.id.map);

        return rl;

    }

和此:

public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mContext = getActivity();

    mMissionDataModel = MissionDataModel.getInstance(mContext);

    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);

    GeoPoint startPoint = new GeoPoint(46.5328, 6.6306);
    IMapController mapController = map.getController();
    mapController.setZoom(11);
    mapController.setCenter(startPoint);

     if(myLocationOverlay == null)
        myLocationOverlay = new DirectedLocationOverlay(mContext);
    else
        map.getOverlays().remove(myLocationOverlay);

    map.getOverlays().add(myLocationOverlay);

    //Add Scale Bar
    ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(mContext);
    map.getOverlays().add(myScaleBarOverlay);

}

片段地图的布局

   <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapfragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <org.osmdroid.views.MapView android:id="@+id/map"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />

    </RelativeLayout>
</LinearLayout>

当我第一次从片段4切换时,我有这个logcat

    09-04 10:53:09.438  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.v*.MapView﹕ Using tile source: org.osmdroid.tileprovider.tilesource.XYTileSource@429569b8
09-04 10:53:09.443  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:09.448  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:09.453  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:09.563  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.LRUMapTileCac*﹕ Tile cache increased from 9 to 35
09-04 10:53:09.603  18516-18516/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 554K, 5% free 38490K/40135K, paused 40ms, total 40ms
09-04 10:53:09.738  18516-19354/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 108K, 4% free 39643K/41095K, paused 36ms, total 36ms
09-04 10:53:09.853  18516-19363/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 213K, 4% free 41024K/42439K, paused 35ms, total 35ms
09-04 10:53:09.913  18516-19350/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 134K, 4% free 42209K/43719K, paused 34ms, total 35ms
09-04 10:53:10.028  18516-19350/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 217K, 4% free 43493K/44999K, paused 35ms, total 36ms
09-04 10:53:10.118  18516-19361/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 143K, 4% free 44838K/46279K, paused 38ms, total 38ms
09-04 10:53:10.213  18516-19361/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 211K, 4% free 46057K/47559K, paused 36ms, total 36ms
09-04 10:53:10.293  18516-19356/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 143K, 4% free 47305K/48839K, paused 38ms, total 38ms
09-04 10:53:10.328  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/Choreographer﹕ Skipped 46 frames!  The application may be doing too much work on its main thread.
09-04 10:53:14.248  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.v*.MapView﹕ Using tile source: org.osmdroid.tileprovider.tilesource.XYTileSource@429569b8
09-04 10:53:14.253  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:14.258  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:14.263  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileFil*﹕ sdcard state: mounted
09-04 10:53:14.368  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.LRUMapTileCac*﹕ Tile cache increased from 9 to 35
09-04 10:53:14.478  18516-19529/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 562K, 3% free 48679K/50119K, paused 41ms, total 50ms
09-04 10:53:14.568  18516-19542/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 190K, 3% free 49980K/51399K, paused 35ms, total 35ms
09-04 10:53:14.653  18516-19538/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 174K, 3% free 51230K/52679K, paused 33ms, total 34ms
09-04 10:53:14.768  18516-19536/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 184K, 3% free 52612K/54023K, paused 37ms, total 39ms
09-04 10:53:14.838  18516-19538/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 167K, 3% free 53765K/55303K, paused 37ms, total 37ms
09-04 10:53:14.938  18516-19539/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 183K, 3% free 55109K/56583K, paused 33ms, total 36ms
09-04 10:53:15.018  18516-19529/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 173K, 3% free 56326K/57863K, paused 35ms, total 36ms
09-04 10:53:15.053  18516-18516/ch.coyoteprod.coyotecad.mobilecad I/Choreographer﹕ Skipped 41 frames!  The application may be doing too much work on its main thread.

然后我有这个内存不足

09-04 10:53:20.948  18516-19733/ch.coyoteprod.coyotecad.mobilecad E/o*.o*.t*.t*.BitmapTile*﹕ OutOfMemoryError loading bitmap
09-04 10:53:21.003  18516-19718/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 65.028MB to 64.000MB
09-04 10:53:21.003  18516-19718/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 39K, 3% free 63728K/65287K, paused 13ms+17ms, total 70ms
09-04 10:53:21.003  18516-19708/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 415ms
09-04 10:53:21.068  18516-19708/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 65.006MB to 64.000MB
09-04 10:53:21.068  18516-19708/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 66K, 3% free 63706K/65287K, paused 3ms+17ms, total 64ms
09-04 10:53:21.068  18516-19722/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 827ms
09-04 10:53:21.133  18516-18516/ch.coyoteprod.coyotecad.mobilecad E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-04 10:53:21.133  18516-18516/ch.coyoteprod.coyotecad.mobilecad E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-04 10:53:21.133  18516-19722/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 65.003MB to 64.000MB
09-04 10:53:21.133  18516-19722/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 31K, 3% free 63703K/65287K, paused 13ms+8ms, total 65ms
09-04 10:53:21.133  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 185ms
09-04 10:53:21.183  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.999MB to 64.000MB
09-04 10:53:21.183  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 5K, 3% free 63698K/65287K, paused 13ms+4ms, total 50ms
09-04 10:53:21.183  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 404ms
09-04 10:53:21.208  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.999MB to 64.000MB
09-04 10:53:21.208  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 3% free 63698K/65287K, paused 24ms, total 24ms
09-04 10:53:21.208  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 262160-byte allocation
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.999MB to 64.000MB
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_BEFORE_OOM freed 0K, 3% free 63698K/65287K, paused 33ms, total 33ms
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad E/dalvikvm-heap﹕ Out of memory on a 262160-byte allocation.
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ "downloader" prio=5 tid=32 RUNNABLE
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x437a5ca8 self=0x610d8370
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | sysTid=19731 nice=0 sched=0/0 cgrp=apps handle=1572382416
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | schedstat=( 160484495 80061083 1859 ) utm=10 stm=5 core=1
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:144)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.lang.Thread.run(Thread.java:856)
09-04 10:53:21.243  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ [ 09-04 10:53:21.243 18516:19712 D/dalvikvm ]
    WAIT_FOR_CONCURRENT_GC blocked 646ms
09-04 10:53:21.248  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/skia﹕ --- decoder->decode returned false
09-04 10:53:21.248  18516-19731/ch.coyoteprod.coyotecad.mobilecad E/o*.o*.t*.t*.BitmapTile*﹕ OutOfMemoryError loading bitmap
09-04 10:53:21.248  18516-19733/ch.coyoteprod.coyotecad.mobilecad W/o*.o*.t*.m*.MapTileDow*﹕ LowMemoryException downloading MapTile: /11/1061/724 : org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
09-04 10:53:21.258  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileMod*﹕ Tile loader can't continue: /11/1061/724
    org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$CantContinueException: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:224)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:151)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: java.lang.OutOfMemoryError
            at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
            at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:144)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
09-04 10:53:21.283  18516-19712/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.995MB to 64.000MB
09-04 10:53:21.283  18516-19712/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 36K, 3% free 63694K/65287K, paused 3ms+5ms, total 38ms
09-04 10:53:21.283  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 32ms
09-04 10:53:21.338  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.939MB to 64.000MB
09-04 10:53:21.338  18516-19731/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 92K, 3% free 63637K/65287K, paused 12ms+6ms, total 59ms
09-04 10:53:21.343  18516-19731/ch.coyoteprod.coyotecad.mobilecad W/o*.o*.t*.m*.MapTileDow*﹕ LowMemoryException downloading MapTile: /11/1062/724 : org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
09-04 10:53:21.353  18516-19731/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileMod*﹕ Tile loader can't continue: /11/1062/724
    org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$CantContinueException: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:224)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:151)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: java.lang.OutOfMemoryError
            at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
            at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:144)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
09-04 10:53:21.548  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.910MB to 64.000MB
09-04 10:53:21.548  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_FOR_ALLOC freed 192K, 3% free 63607K/65287K, paused 36ms, total 36ms
09-04 10:53:21.548  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 262160-byte allocation
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.910MB to 64.000MB
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_BEFORE_OOM freed 0K, 3% free 63607K/65287K, paused 32ms, total 32ms
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad E/dalvikvm-heap﹕ Out of memory on a 262160-byte allocation.
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ "downloader" prio=5 tid=34 RUNNABLE
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x434c1498 self=0x610d4798
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | sysTid=19733 nice=0 sched=0/0 cgrp=apps handle=1572382512
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ | schedstat=( 371508693 77115930 1961 ) utm=30 stm=6 core=1
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:144)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ at java.lang.Thread.run(Thread.java:856)
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm﹕ [ 09-04 10:53:21.583 18516:19733 D/skia     ]
    --- decoder->decode returned false
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad E/o*.o*.t*.t*.BitmapTile*﹕ OutOfMemoryError loading bitmap
09-04 10:53:21.583  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 0ms
09-04 10:53:21.618  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/dalvikvm-heap﹕ Clamp target GC heap from 64.894MB to 64.000MB
09-04 10:53:21.618  18516-19733/ch.coyoteprod.coyotecad.mobilecad D/dalvikvm﹕ GC_EXPLICIT freed 16K, 3% free 63590K/65287K, paused 2ms+4ms, total 36ms
09-04 10:53:21.618  18516-19733/ch.coyoteprod.coyotecad.mobilecad W/o*.o*.t*.m*.MapTileDow*﹕ LowMemoryException downloading MapTile: /11/1058/725 : org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
09-04 10:53:21.628  18516-19733/ch.coyoteprod.coyotecad.mobilecad I/o*.o*.t*.m*.MapTileMod*﹕ Tile loader can't continue: /11/1058/725
    org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$CantContinueException: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:224)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase$LowMemoryException: java.lang.OutOfMemoryError
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:151)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
     Caused by: java.lang.OutOfMemoryError
            at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
            at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
            at org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.getDrawable(BitmapTileSourceBase.java:144)
            at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:214)
            at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:293)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)

我不明白为什么...... 非常感谢您的帮助...

1 个答案:

答案 0 :(得分:1)

https://code.google.com/p/osmdroid/issues/detail?id=265

找到部分“解决方案”

中加入: map.getTileProvider().clearTileCache();解决问题...