简体   繁体   English

由于'进程崩溃'导致仪表运行失败

[英]Instrumentation run failed due to 'Process crashed'

My code workes fine when i run it as normal but when i run this unit test this error is printed in the console. 正常运行时我的代码运行正常,但是当我运行此单元测试时,控制台中会打印出此错误。 what i'm doing wrong with this unit test? 我对这个单元测试做错了什么?

Test run failed: Instrumentation run failed due to 'Process crashed.' 测试运行失败:由于“进程崩溃”,仪表运行失败。

LogCat logcat的

01-13 03:52:12.560: I/DEBUG(31): *** *** *** *** *** *** *** *** *** *** *** *** *** 

*** *** ***
01-13 03:52:12.560: I/DEBUG(31): Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys'
01-13 03:52:12.560: I/DEBUG(31): pid: 446, tid: 452  >>> com.frozendragon.Sceptrum <<<
01-13 03:52:12.560: I/DEBUG(31): signal 11 (SIGSEGV), fault addr 00000028
01-13 03:52:12.560: I/DEBUG(31):  r0 00000000  r1 0026148c  r2 00000000  r3 0026148c
01-13 03:52:12.560: I/DEBUG(31):  r4 00260bd8  r5 002614cc  r6 00000000  r7 00000000
01-13 03:52:12.560: I/DEBUG(31):  r8 00000001  r9 00000000  10 00000000  fp 00000000
01-13 03:52:12.560: I/DEBUG(31):  ip 00000000  sp 485c1b38  lr 00000000  pc ab166044  cpsr 60000010
01-13 03:52:12.606: I/DEBUG(31):          #00  pc 00066044  /system/lib/libskia.so
01-13 03:52:12.606: I/DEBUG(31):          #01  pc 00068bb4  /system/lib/libskia.so
01-13 03:52:12.606: I/DEBUG(31):          #02  pc 00064e68  /system/lib/libskia.so
01-13 03:52:12.606: I/DEBUG(31):          #03  pc 0004b1ea  /system/lib/libandroid_runtime.so
01-13 03:52:12.606: I/DEBUG(31):          #04  pc 00013974  /system/lib/libdvm.so
01-13 03:52:12.606: I/DEBUG(31):          #05  pc 0003ddb4  /system/lib/libdvm.so
01-13 03:52:12.606: I/DEBUG(31):          #06  pc 00037186  /system/lib/libdvm.so
01-13 03:52:12.606: I/DEBUG(31):          #07  pc 00018714  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #08  pc 0001e8c4  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #09  pc 0001d790  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #10  pc 0005408e  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #11  pc 0005bde2  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #12  pc 00018714  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #13  pc 0001e8c4  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #14  pc 0001d790  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #15  pc 00053eec  /system/lib/libdvm.so
01-13 03:52:12.616: I/DEBUG(31):          #16  pc 00054102  /system/lib/libdvm.so
01-13 03:52:12.626: I/DEBUG(31):          #17  pc 0004825a  /system/lib/libdvm.so
01-13 03:52:12.626: I/DEBUG(31):          #18  pc 0001103c  /system/lib/libc.so
01-13 03:52:12.626: I/DEBUG(31):          #19  pc 00010b20  /system/lib/libc.so
01-13 03:52:12.626: I/DEBUG(31): code around pc:
01-13 03:52:12.626: I/DEBUG(31): ab166024 e59d001c e3a01000 e5c010a8 eaffff95 
01-13 03:52:12.626: I/DEBUG(31): ab166034 e1d4e2f4 e1d472f6 e5946004 e197200e 
01-13 03:52:12.626: I/DEBUG(31): ab166044 e5969028 e596a024 0a00002e e59db00c 
01-13 03:52:12.626: I/DEBUG(31): ab166054 e2848028 e1a0c008 e8bb000f e8ac000f 
01-13 03:52:12.626: I/DEBUG(31): ab166064 e8bb000f e8ac000f e89b0003 e26eb000 
01-13 03:52:12.626: I/DEBUG(31): code around lr:
01-13 03:52:12.626: I/DEBUG(31): stack:
01-13 03:52:12.626: I/DEBUG(31):     485c1af8  43480000  /data/dalvik-cache/system@framework@framework.jar@classes.dex
01-13 03:52:12.626: I/DEBUG(31):     485c1afc  002613c8  [heap]
01-13 03:52:12.626: I/DEBUG(31):     485c1b00  485c1be8  
01-13 03:52:12.626: I/DEBUG(31):     485c1b04  00261020  [heap]
01-13 03:52:12.626: I/DEBUG(31):     485c1b08  485c1be8  
01-13 03:52:12.626: I/DEBUG(31):     485c1b0c  ab165be8  /system/lib/libskia.so
01-13 03:52:12.626: I/DEBUG(31):     485c1b10  00000001  
01-13 03:52:12.636: I/DEBUG(31):     485c1b14  00000007  
01-13 03:52:12.636: I/DEBUG(31):     485c1b18  420d1a98  /dev/ashmem/dalvik-LinearAlloc (deleted)
01-13 03:52:12.636: I/DEBUG(31):     485c1b1c  80846dad  /system/lib/libdvm.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b20  00000024  
01-13 03:52:12.636: I/DEBUG(31):     485c1b24  00231b78  [heap]
01-13 03:52:12.636: I/DEBUG(31):     485c1b28  46002d90  /dev/ashmem/mspace/dalvik-heap/2 (deleted)
01-13 03:52:12.636: I/DEBUG(31):     485c1b2c  8083d9b9  /system/lib/libdvm.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b30  df002777  
01-13 03:52:12.636: I/DEBUG(31):     485c1b34  e3a070ad  
01-13 03:52:12.636: I/DEBUG(31): #00 485c1b38  46002d90  /dev/ashmem/mspace/dalvik-heap/2 (deleted)
01-13 03:52:12.636: I/DEBUG(31):     485c1b3c  8082e5b3  /system/lib/libdvm.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b40  00000000  
01-13 03:52:12.636: I/DEBUG(31):     485c1b44  002614a4  [heap]
01-13 03:52:12.636: I/DEBUG(31):     485c1b48  00004000  
01-13 03:52:12.636: I/DEBUG(31):     485c1b4c  ffffffff  
01-13 03:52:12.636: I/DEBUG(31):     485c1b50  00000000  
01-13 03:52:12.636: I/DEBUG(31):     485c1b54  00261020  [heap]
01-13 03:52:12.636: I/DEBUG(31):     485c1b58  485c1be8  
01-13 03:52:12.636: I/DEBUG(31):     485c1b5c  002316e8  [heap]
01-13 03:52:12.636: I/DEBUG(31):     485c1b60  46002d90  /dev/ashmem/mspace/dalvik-heap/2 (deleted)
01-13 03:52:12.636: I/DEBUG(31):     485c1b64  ad32e451  /system/lib/libandroid_runtime.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b68  ad374d50  /system/lib/libandroid_runtime.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b6c  ad34bf0f  /system/lib/libandroid_runtime.so
01-13 03:52:12.636: I/DEBUG(31):     485c1b70  485c1f00  
01-13 03:52:12.636: I/DEBUG(31):     485c1b74  485c1be8  
01-13 03:52:12.646: I/DEBUG(31):     485c1b78  00261020  [heap]
01-13 03:52:12.646: I/DEBUG(31):     485c1b7c  ab165b68  /system/lib/libskia.so
01-13 03:52:12.646: I/DEBUG(31):     485c1b80  485c1be8  
01-13 03:52:12.646: I/DEBUG(31):     485c1b84  485c1c0c  
01-13 03:52:12.646: I/DEBUG(31):     485c1b88  485c1bb0  
01-13 03:52:12.646: I/DEBUG(31):     485c1b8c  00261020  [heap]
01-13 03:52:12.646: I/DEBUG(31):     485c1b90  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1b94  00000001  
01-13 03:52:12.646: I/DEBUG(31):     485c1b98  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1b9c  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1ba0  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1ba4  ab168bb8  /system/lib/libskia.so
01-13 03:52:12.646: I/DEBUG(31): #01 485c1ba8  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1bac  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1bb0  000013fc  
01-13 03:52:12.646: I/DEBUG(31):     485c1bb4  000001b8  
01-13 03:52:12.646: I/DEBUG(31):     485c1bb8  485c1c68  
01-13 03:52:12.646: I/DEBUG(31):     485c1bbc  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1bc0  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1bc4  00000000  
01-13 03:52:12.646: I/DEBUG(31):     485c1bc8  00261020  [heap]
01-13 03:52:12.646: I/DEBUG(31):     485c1bcc  433f6c68  /data/dalvik-cache/system@framework@framework.jar@classes.dex
01-13 03:52:12.646: I/DEBUG(31):     485c1bd0  8086caa4  /system/lib/libdvm.so
01-13 03:52:12.646: I/DEBUG(31):     485c1bd4  80870eea  /system/lib/libdvm.so
01-13 03:52:12.646: I/DEBUG(31):     485c1bd8  000013fc  
01-13 03:52:12.646: I/DEBUG(31):     485c1bdc  80887fc4  /system/lib/libdvm.so
01-13 03:52:12.646: I/DEBUG(31):     485c1be0  485c1f00  
01-13 03:52:12.656: I/DEBUG(31):     485c1be4  485c1c0c  
01-13 03:52:12.656: I/DEBUG(31):     485c1be8  00261020  [heap]
01-13 03:52:12.656: I/DEBUG(31):     485c1bec  00000003  
01-13 03:52:12.656: I/DEBUG(31):     485c1bf0  00000000  
01-13 03:52:12.656: I/DEBUG(31):     485c1bf4  485c1c68  
01-13 03:52:12.656: I/DEBUG(31):     485c1bf8  43957d20  
01-13 03:52:12.656: I/DEBUG(31):     485c1bfc  43957d0c  
01-13 03:52:12.656: I/DEBUG(31):     485c1c00  00231b78  [heap]
01-13 03:52:12.656: I/DEBUG(31):     485c1c04  ab164e6c  /system/lib/libskia.so
01-13 03:52:13.006: I/BootReceiver(73): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
01-13 03:52:13.026: D/Zygote(33): Process 446 terminated by signal (11)
01-13 03:52:13.076: D/dalvikvm(73): GC_FOR_MALLOC freed 4012 objects / 829984 bytes in 66ms
01-13 03:52:13.076: I/ActivityManager(73): Process com.frozendragon.Sceptrum (pid 446) has died.
01-13 03:52:13.076: W/ActivityManager(73): Crash of app com.frozendragon.Sceptrum running instrumentation ComponentInfo{com.frozendragon.Sceptrum.test/android.test.InstrumentationTestRunner}
01-13 03:52:13.076: I/ActivityManager(73): Force stopping package com.frozendragon.Sceptrum uid=10028
01-13 03:52:13.087: D/AndroidRuntime(440): Shutting down VM
01-13 03:52:13.087: D/jdwp(440): Got wake-up signal, bailing out of select
01-13 03:52:13.087: D/dalvikvm(440): Debugger has detached; object registry had 1 entries
01-13 03:54:28.720: D/SntpClient(73): request time failed: java.net.SocketException: Address family not supported by protocol

Unit test code 单元测试代码

Point ImagesPos, SheetSize, CurrentSprite, Size;
    protected void setUp() throws Exception {
        super.setUp();
        gameEngine = new GameEngine(400, 800);
        canvas = new Canvas();
        ImagesPos = new Point(200, 200);
        SheetSize = new Point(9, 9);
        CurrentSprite = new Point(2, 3);
        Size = new Point(200, 400);
        Context context = getContext();
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inScaled = true;
        animationbmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.foot_animation_spritesheet9x9, options);
    }
    public void testDrawAnimationObjectCanvasBitmapIntIntPointPointFloat() {
        float rot = 45f;
        gameEngine.DrawAnimationObject(canvas, animationbmp, ImagesPos.x, ImagesPos.y, SheetSize, CurrentSprite, rot);
        animationbmp.recycle();
        gameEngine.DrawAnimationObject(canvas, animationbmp, ImagesPos.x, ImagesPos.y, SheetSize, CurrentSprite, rot);
        restorebmp();
    }
private void restorebmp()
{
    if(animationbmp.isRecycled() == false)
    {
        animationbmp.recycle();
    }
    Context context = getContext();
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inScaled = true;
    animationbmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.foot_animation_spritesheet9x9, options);
}

It appears your code is recycling a bitmap and then immediately trying to use it again: 您的代码似乎正在回收位图,然后立即尝试再次使用它:

    gameEngine.DrawAnimationObject(canvas, animationbmp, ImagesPos.x, ImagesPos.y, SheetSize, CurrentSprite, rot);
    //////////////////////////////////////////////
    animationbmp.recycle(); //Offending line here/
    //////////////////////////////////////////////
    gameEngine.DrawAnimationObject(canvas, animationbmp, ImagesPos.x, ImagesPos.y, SheetSize, CurrentSprite, rot);

You shouldn't use a bitmap after its been recycled. 回收后不应使用位图。 You need to recreate that bitmap object again as the memory is now invalid. 您需要再次重新创建该位图对象,因为内存现在无效。

A C++ library you called crashed by trying to dereference memory address 0x00...28. 您调用的C ++库通过尝试取消引用内存地址0x00 ... 28而崩溃。 Looks like libskia.so, which is a part of android dealing with the graphics subsystem. 看起来像libskia.so,它是android处理图形子系统的一部分。 That memory address means it probably was looking at the Nth item in an array, but the array was null. 该内存地址意味着它可能正在查看数组中的第N项,但该数组为null。 I'd look for a null pointer being passed to a drawing call, or do some serious google searching on libskia errors. 我会寻找传递给绘图调用的空指针,或者对libskia错误进行一些严肃的谷歌搜索。 I'm afraid I can't help more than that, but its a start. 我担心我无法帮助更多,但这是一个开始。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于“java.io.FileNotFoundException”,仪器运行失败 - Instrumentation run failed due to 'java.io.FileNotFoundException' “测试无法运行至完成。由于&#39;java.lang.NullPointerException,检测运行失败” - "Test failed to run to completion. Instrumentation run failed due to 'java.lang.NullPointerException'' Android Espresso UI测试-测试运行失败:由于“ java.lang.IllegalAccessError”,检测运行失败 - Android Espresso UI test - Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError' 由于Robotium测试项目中带有“ Actionbar Sherlock”的“ java.lang.IllegalAccessError”,仪表运行失败 - Instrumentation run failed due to 'java.lang.IllegalAccessError' in Robotium test project with actionbar sherlock 通过Espresso运行单元测试时,由于“ java.lang.ClassNotFoundException”错误,导致仪表运行失败 - Instrumentation run failed due to 'java.lang.ClassNotFoundException'error while running Unit test through Espresso Android检测运行失败 - 断言错误 - Android instrumentation run failed - assertion error Android单元测试:由于类错误,检测失败 - Android Unit Test : Instrumentation failed due to a class error 实例因死锁而崩溃 - Instance Crashed due to Deadlock 没有仪器注册! 必须在注册仪器下运行 - No instrumentation registered! Must run under a registering instrumentation 如果Java进程崩溃则捕获 - Catch if the Java process crashed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM