Android应用程序崩溃,没有给出任何警告,错误或强制关闭消息

时间:2012-02-17 11:14:18

标签: android canvas java-native-interface

我正在开发一个应用程序,我在其中绘制基于svg的图表并保存在SD卡中。当我重新打开图表时,它会崩溃而不会给出任何错误,警告或甚至不给予强制关闭消息。这是应用程序在setBounds方法上崩溃的地方。

        if (myDrawable != null) {

            Log.e("RECTS ", "Left = "+ mRect.left + "TOP = " + mRect.top + "Right = " + mRect.right + "Bottom = " + mRect.bottom);
            myDrawable.setBounds(mRect);


            myDrawable.setColorFilter(DiagramDrawingView._color[getLineColor()],android.graphics.PorterDuff.Mode.SRC_ATOP);
            myDrawable.draw(canvas);

            mPaint.setColor(DiagramDrawingView._color[getLineColor()]);

        }

这是我的logcat。

02-17 17:21:29.494: I/ActivityManager(96): Starting: Intent { cmp=com.linkezii/com.linkezzi.maindrawing.DiagramDesignViewController } from pid 1453602-17 17:21:29.594: D/dalvikvm(14536): GC_EXTERNAL_ALLOC freed 45K, 48% free 2970K/5639K, external 5017K/5197K, paused 30ms
02-17 17:21:29.914: E/dir(14536): /mnt/sdcard/myDiagrams/ghost
02-17 17:21:29.944: I/Loaded Diagram XML =(14536): <com.linkezzi.maindrawing.Diagram>  <Diagram>myDiagram</Diagram>  <nodeBackup>    <com.linkezzi.maindrawing.Node>      <nodeRect>        <bottom>578</bottom>        <left>518</left>        <right>567</right>        <top>528</top>      </nodeRect>      <nodeCenterPoint>        <x>542</x>        <y>553</y>      </nodeCenterPoint>      <NodesConnectedTo>        <com.linkezzi.maindrawing.Node>          <nodeRect>            <bottom>782</bottom>            <left>640</left>            <right>685</right>            <top>732</top>          </nodeRect>          <nodeCenterPoint>            <x>662</x>            <y>757</y>          </nodeCenterPoint>          <NodesConnectedTo/>          <cardlebelPoints>            <x>669</x>            <y>782</y>          </cardlebelPoints>          <dir>/mnt/sdcard/iconSets/iconSet1/icon86.svg</dir>          <mCards/>          <iconSet__icon>iconSet1_icon86.svg</iconSet__icon>          <lebelString></lebelString>          <lebelPoints>            <x>662</x>            <y>795</y>          </lebelPoints>          <isSelected>true</isSelected>          <isFacebookNode>false</isFacebookNode>          <imageCard>1000</imageCard>          <h>50</h>          <fileCard>6000</fileCard>          <cardFlag>false</cardFlag>          <audioCard>2000</audioCard>          <noOfAudioCardAdded>0</noOfAudioCardAdded>          <noOfCard>0</noOfCard>          <noOfImageCardAdded>0</noOfImageCardAdded>          <noOfNotesCardAdded>0</noOfNotesCardAdded>          <noOfPhoneCardAdded>0</noOfPhoneCardAdded>          <noOfWebCardAdded>0</noOfWebCardAdded>          <noOffileCardAdded>0</noOffileCardAdded>          <NodeID>2</NodeID>          <nodeColorInfo>-1</nodeColorInfo>          <LineColor>-6887680</LineColor>          <notesCard>3000</notesCard>          <phoneCard>4000</phoneCard>          <size>1</size>          <w>45</w>          <webCard>5000</webCard>          <x>640</x>          <y>732</y>        </com.linkezzi.maindrawing.Node>      </NodesConnectedTo>      <cardlebelPoints>        <x>549</x>        <y>578</y>      </cardlebelPoints>      <dir>/mnt/sdcard/iconSets/iconSet1/icon87.svg</dir>      <mCards/>      <iconSet__icon>iconSet1_icon87.svg</iconSet__icon>      <lebelString></lebelString>      <lebelPoints>        <x>542</x>        <y>591</y>      </lebelPoints>      <isSelected>false</isSelected>      <isFacebookNode>false</isFacebookNode>      <imageCard>1000</imageCard>      <h>50</h>      <fileCard>6000</fileCard>      <cardFlag>false</cardFlag>      <audioCard>2000</audioCard>      <noOfAudioCardAdded>0</noOfAudioCardAdded>      <noOfCard>0</noOfCard>      <noOfImageCardAdded>0</noOfImageCardAdded>      <noOfNotesCardAdded>0</noOfNotesCardAdded>      <noOfPhoneCardAdded>0</noOfPhoneCardAdded>      <noOfWebCardAdded>0</noOfWebCardAdded>      <noOffileCardAdded>0</noOffileCardAdded>      <NodeID>1</NodeID>      <nodeColorInfo>-1</nodeColorInfo>      <LineColor>-6887680</LineColor>      <notesCard>3000</notesCard>      <phoneCard>4000</phoneCard>      <size>1</size>      <w>49</w>      <webCard>5000</webCard>      <x>518</x>      <y>528</y>    </com.linkezzi.maindrawing.Node>    <com.linkezzi.maindrawing.Node reference="../com.linkezzi.maindrawing.Node/NodesConnectedTo/com.linkezzi.maindrawing.Node"/>  </nodeBackup>  <diamondBackup>    <com.linkezzi.maindrawing.LineDiamond>      <NodeFrom reference="../../../nodeBackup/com.linkezzi.maindrawing.Node/NodesConnectedTo/com.linkezzi.maindrawing.Node"/>      <NodeTo reference="../../../nodeBackup/com.linkezzi.maindrawing.Node"/>      <pt2 reference="../../../nodeBackup/com.linkezzi.maindrawing.Node/NodesConnectedTo/com.linkezzi.maindrawing.Node/nodeCenterPoint"/>      <blackPaint>        <mNativePaint>5025784</mNativePaint>        <mInvCompatScaling>1.0</mInvCompatScaling>        <mHasCompatScaling>false</mHasCompatScaling>        <mCompatScaling>1.0</mCompatScaling>      </blackPaint>      <pt1 reference="../../../nodeBackup/com.linkezzi.maindrawing.Node/nodeCenterPoint"/>      <mRect>        <bottom>667</bottom> 
02-17 17:21:30.584: E/Step 1(14536): Step 1
02-17 17:21:30.704: D/dalvikvm(14536): GC_CONCURRENT freed 991K, 51% free 3302K/6727K, external 12112K/12112K, paused 3ms+3ms
02-17 17:21:30.714: E/Step 2(14536): Step 2
02-17 17:21:30.714: E/Step 3(14536): Step 3 0
02-17 17:21:30.714: E/Step 7(14536): Step 7
02-17 17:21:30.714: E/Step 8(14536): Step 8
02-17 17:21:30.714: E/Step 9(14536): Step 9
02-17 17:21:30.764: D/dalvikvm(14536): Trying to load lib /data/data/com.linkezii/lib/libsvgandroid.so 0x40513b70
02-17 17:21:30.764: D/dalvikvm(14536): Added shared lib /data/data/com.linkezii/lib/libsvgandroid.so 0x40513b70
02-17 17:21:30.774: D/dalvikvm(14536): No JNI_OnLoad found in /data/data/com.linkezii/lib/libsvgandroid.so 0x40513b70, skipping init
02-17 17:21:30.774: E/Node(14536): Restored
02-17 17:21:30.784: E/Node(14536): Restored
02-17 17:21:30.794: E/Node(14536): Restored
02-17 17:21:30.884: I/ActivityManager(96): Displayed com.linkezii/com.linkezzi.maindrawing.DiagramDesignViewController: +1s374ms
02-17 17:21:31.064: E/Step 1(14536): Step 1
02-17 17:21:31.104: E/RECTS(14536): Left = 590TOP = 643Right = 614Bottom = 667
02-17 17:21:31.154: D/dalvikvm(14536): GC_EXTERNAL_ALLOC freed 223K, 54% free 3127K/6727K, external 12112K/12112K, paused 48ms
02-17 17:21:31.154: W/Step 1(14536): Step 1 0
02-17 17:21:31.154: I/DEBUG(14535): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-17 17:21:31.154: I/DEBUG(14535): Build fingerprint: 'google/passion/passion:2.3.6/GRK39F/189904:user/release-keys'
02-17 17:21:31.154: I/DEBUG(14535): pid: 14536, tid: 14537  >>> com.linkezii <<<
02-17 17:21:31.154: I/DEBUG(14535): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 004caff8
02-17 17:21:31.154: I/DEBUG(14535):  r0 004caff8  r1 40028c28  r2 004caff8  r3 43c95fd4
02-17 17:21:31.154: I/DEBUG(14535):  r4 004caff8  r5 00000000  r6 100ffb70  r7 43c95fa8
02-17 17:21:31.164: I/DEBUG(14535):  r8 100ffac8  r9 43c95fa0  10 43c95f8c  fp 800a5368
02-17 17:21:31.164: I/DEBUG(14535):  ip ad381028  sp 100ffab0  lr ad357789  pc ab17a548  cpsr a0000010
02-17 17:21:31.164: I/DEBUG(14535):  d0  0000000000005100  d1  0065007200680070
02-17 17:21:31.164: I/DEBUG(14535):  d2  002e007000700008  d3  0069007400630000
02-17 17:21:31.164: I/DEBUG(14535):  d4  ffffffff002a5a88  d5  00000008ffffffff
02-17 17:21:31.164: I/DEBUG(14535):  d6  0000001800100101  d7  3eaaaaab3f800000
02-17 17:21:31.164: I/DEBUG(14535):  d8  0000000000000000  d9  0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d10 0000000000000000  d11 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d12 0000000000000000  d13 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d14 0000000000000000  d15 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d16 0000000003fa1cec  d17 3ff0000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d18 42eccefa43de3400  d19 3fbc71c71c71c71c
02-17 17:21:31.164: I/DEBUG(14535):  d20 4008000000000000  d21 3fd99a27ad32ddf5
02-17 17:21:31.164: I/DEBUG(14535):  d22 3fd24998d6307188  d23 3fcc7288e957b53b
02-17 17:21:31.164: I/DEBUG(14535):  d24 3fc74721cad6b0ed  d25 3fc39a09d078c69f
02-17 17:21:31.164: I/DEBUG(14535):  d26 0000000000000000  d27 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d28 0000000000000000  d29 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  d30 0000000000000000  d31 0000000000000000
02-17 17:21:31.164: I/DEBUG(14535):  scr 80000012

02-17 17:21:31.224: I/DEBUG(14535):          #00  pc 0007a548  /system/lib/libskia.so
02-17 17:21:31.234: I/DEBUG(14535):          #01  pc 00057786  /system/lib/libandroid_runtime.so
02-17 17:21:31.234: I/DEBUG(14535):          #02  pc 00017e34  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #03  pc 00049646  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #04  pc 0001d034  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #05  pc 000220e4  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #06  pc 00020fdc  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #07  pc 0005fc40  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #08  pc 0005fe54  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #09  pc 00055fec  /system/lib/libdvm.so
02-17 17:21:31.244: I/DEBUG(14535):          #10  pc 00056068  /system/lib/libdvm.so
02-17 17:21:31.254: I/DEBUG(14535):          #11  pc 000561fa  /system/lib/libdvm.so
02-17 17:21:31.254: I/DEBUG(14535):          #12  pc 000540ce  /system/lib/libdvm.so
02-17 17:21:31.254: I/DEBUG(14535):          #13  pc 000118e4  /system/lib/libc.so
02-17 17:21:31.254: I/DEBUG(14535):          #14  pc 000114b0  /system/lib/libc.so
02-17 17:21:31.254: I/DEBUG(14535): code around pc:
02-17 17:21:31.254: I/DEBUG(14535): ab17a528 eaffffa0 e5860004 e1a00006 e5963000 
02-17 17:21:31.254: I/DEBUG(14535): ab17a538 e1a0e00f e593f004 eaffff93 e92d4070 
02-17 17:21:31.254: I/DEBUG(14535): ab17a548 e5905000 e1a04000 e3550000 0a000003 
02-17 17:21:31.254: I/DEBUG(14535): ab17a558 e2850004 ebfebbef e3500001 0a00005d 
02-17 17:21:31.254: I/DEBUG(14535): ab17a568 e5945010 e3550000 0a000003 e2850004 
02-17 17:21:31.254: I/DEBUG(14535): code around lr:
02-17 17:21:31.254: I/DEBUG(14535): ad357768 f361303a f8841346 f7cc303a 4620eaf8 
02-17 17:21:31.254: I/DEBUG(14535): ad357778 bf00bd10 4614b510 4610b12a ef7ef7ca 
02-17 17:21:31.254: I/DEBUG(14535): ad357788 f7c94620 bd10ef24 6802b510 32e4f8d2 
02-17 17:21:31.254: I/DEBUG(14535): ad357798 47982200 bf00bd10 43f7e92d 46049f0a 
02-17 17:21:31.254: I/DEBUG(14535): ad3577a8 4616460d b1014699 4620b91a f9aef7fd 
02-17 17:21:31.254: I/DEBUG(14535): stack:
02-17 17:21:31.254: I/DEBUG(14535):     100ffa70  00332c50  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa74  0000a000  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa78  100ffac8  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa7c  43c95fa0  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa80  43c95f8c  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa84  afd1362d  /system/lib/libc.so
02-17 17:21:31.254: I/DEBUG(14535):     100ffa88  00332c50  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa8c  00000000  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa90  100ffb70  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa94  43c95fa8  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa98  100ffac8  
02-17 17:21:31.254: I/DEBUG(14535):     100ffa9c  afd144dd  /system/lib/libc.so
02-17 17:21:31.254: I/DEBUG(14535):     100ffaa0  00332c50  
02-17 17:21:31.254: I/DEBUG(14535):     100ffaa4  afc009c7  /system/lib/libstdc++.so
02-17 17:21:31.264: I/DEBUG(14535):     100ffaa8  df002777  
02-17 17:21:31.264: I/DEBUG(14535):     100ffaac  e3a070ad  
02-17 17:21:31.264: I/DEBUG(14535): #00 100ffab0  004caff8  
02-17 17:21:31.264: I/DEBUG(14535):     100ffab4  00000000  
02-17 17:21:31.264: I/DEBUG(14535):     100ffab8  100ffb70  
02-17 17:21:31.264: I/DEBUG(14535):     100ffabc  ad357789  /system/lib/libandroid_runtime.so
02-17 17:21:31.264: I/DEBUG(14535): #01 100ffac0  100ffae8  
02-17 17:21:31.264: I/DEBUG(14535):     100ffac4  80017e38  /system/lib/libdvm.so
02-17 17:21:31.514: I/DEBUG(14535): debuggerd committing suicide to free the zombie!
02-17 17:21:31.514: I/BootReceiver(96): Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
02-17 17:21:31.534: I/DEBUG(14545): debuggerd: Sep 20 2011 11:21:24
02-17 17:21:31.534: I/ActivityManager(96): Process com.linkezii (pid 14536) has died.
02-17 17:21:31.544: I/WindowManager(96): WIN DEATH: Window{40b9b228 com.linkezii/com.linkezzi.maindrawing.DiagramDesignViewController paused=false}
02-17 17:21:31.544: I/WindowManager(96): WIN DEATH: Window{40b16320 com.linkezii/com.linkezii.DiagramListView paused=false}
02-17 17:21:31.554: I/ActivityManager(96): Start proc com.linkezii for activity com.linkezii/.DiagramListView: pid=14546 uid=10059 gids={3003, 1015}
02-17 17:21:31.564: D/Zygote(67): Process 14536 terminated by signal (11)
02-17 17:21:31.624: D/dalvikvm(14546): Debugger has detached; object registry had 1 entries
02-17 17:21:31.784: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 79K, 48% free 2846K/5379K, external 1936K/2137K, paused 40ms
02-17 17:21:31.884: W/PhoneWindow(14546): Previously focused view reported id 2131165282 during save, but can't be found during restore.
02-17 17:21:31.984: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 229K, 49% free 2926K/5639K, external 2789K/2840K, paused 30ms
02-17 17:21:32.044: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 22K, 49% free 2912K/5639K, external 3233K/3246K, paused 27ms
02-17 17:21:32.114: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 10K, 49% free 2926K/5639K, external 3233K/3246K, paused 31ms
02-17 17:21:32.184: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 12K, 48% free 2952K/5639K, external 3546K/3636K, paused 27ms
02-17 17:21:32.194: W/InputManagerService(96): Got RemoteException sending setActive(false) notification to pid 14536 uid 10059
02-17 17:21:32.254: D/dalvikvm(14546): GC_EXTERNAL_ALLOC freed 11K, 48% free 2965K/5639K, external 4483K/4612K, paused 28ms
02-17 17:21:32.334: I/ActivityManager(96): Displayed com.linkezii/.DiagramListView: +784ms

3 个答案:

答案 0 :(得分:0)

听起来像是本机层崩溃。 logcat中会有大量的信息。

答案 1 :(得分:0)

这是因为当我们使用更多图像时...模拟器会崩溃..可能是由于

          java.lang.OutOfMemoryError: bitmap size exceeds VM budget
          at android.graphics.Bitmap.nativeCreate(Native Method)...

所以在手机而不是模拟器上试试

如果它甚至在你的手机中崩溃意味着...... 将图像移动到“assets”文件夹并使用以下函数获取BitmapDrawable

         public static Drawable getAssetImage(Context context, String filename) throws  
         IOException {
         AssetManager assets = context.getResources().getAssets();
         InputStream buffer = new BufferedInputStream((assets.open("drawable/" + f    
         ilename + ".png")));
         Bitmap bitmap = BitmapFactory.decodeStream(buffer);
         return new BitmapDrawable(bitmap);
         }

答案 2 :(得分:0)

没有办法,当应用程序崩溃然后给出原因时,如果你将通过模拟器测试应用程序,那么请正确检查你的日志猫并理解崩溃的原因..