gpt4 book ai didi

java - 运行 Android KitKat 代码在 Lollipop 设备上崩溃

转载 作者:行者123 更新时间:2023-11-30 10:50:48 24 4
gpt4 key购买 nike

我一直在开发一款社交媒体应用程序,到目前为止,它在运行 KitKat 及更低版本的所有设备上运行良好。

我尝试在 Lollipop 和更高版本的操作系统上运行它,但它崩溃了。

经过数周的调试,我得到的仍然是一条与我的代码无关的错误消息:

01-22 00:37:09.481 6661-6672/supernet.interactapp A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x74616433 in tid 6672 (FinalizerDaemon)
01-22 00:37:09.480 6661-6676/supernet.interactapp I/art: Background sticky concurrent mark sweep GC freed 7891(375KB) AllocSpace objects, 4(64KB) LOS objects, 35% free, 723KB/1117KB, paused 39.238ms total 140.184ms
01-22 00:37:09.501 5229-5290/supernet.interactapp:remote E/Ultra Admin: retrieve messages called: CONNECTED
01-22 00:37:09.571 6661-6676/supernet.interactapp I/art: Background partial concurrent mark sweep GC freed 447(37KB) AllocSpace objects, 0(0B) LOS objects, 57% free, 764KB/1788KB, paused 6.993ms total 51.547ms
01-22 00:37:09.588 85-85/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-22 00:37:09.588 85-85/? I/DEBUG: Build fingerprint: 'generic/vbox86p/vbox86p:5.1/LMY47D/buildbot11172007:userdebug/test-keys'
01-22 00:37:09.588 85-85/? I/DEBUG: Revision: '0'
01-22 00:37:09.588 85-85/? I/DEBUG: ABI: 'x86'
01-22 00:37:09.588 85-85/? I/DEBUG: pid: 6661, tid: 6672, name: FinalizerDaemon >>> supernet.interactapp <<<
01-22 00:37:09.588 85-85/? I/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x74616433
01-22 00:37:09.651 85-85/? I/DEBUG: eax 7461642f ebx f6352bac ecx 00000001 edx 70612f61
01-22 00:37:09.651 85-85/? I/DEBUG: esi f3e9ebe0 edi f3e9ebe0
01-22 00:37:09.652 85-85/? I/DEBUG: xcs 00000023 xds 0000002b xes 0000002b xfs 0000003f xss 0000002b
01-22 00:37:09.652 85-85/? I/DEBUG: eip f5fd09fb ebp 00000000 esp eebff950 flags 00210282
01-22 00:37:09.653 85-85/? I/DEBUG: #00 pc 001019fb /system/lib/libskia.so (SkBitmap::freePixels()+43)
01-22 00:37:09.653 85-85/? I/DEBUG: #01 pc 00101a6a /system/lib/libskia.so (SkBitmap::~SkBitmap()+26)
01-22 00:37:09.667 85-85/? I/DEBUG: #02 pc 000e02e3 /system/lib/libandroid_runtime.so
01-22 00:37:09.687 85-85/? I/DEBUG: #03 pc 0001d992 /data/dalvik-cache/x86/system@framework@boot.oat
01-22 00:37:09.697 85-85/? I/DEBUG: #04 pc 70612f60 <unknown>
01-22 00:37:09.704 85-85/? I/DEBUG: #05 pc 892cec82 <unknown>
01-22 00:37:09.740 85-85/? W/libbacktrace: virtual bool Backtrace::VerifyReadWordArgs(uintptr_t, word_t*): invalid pointer 0x74616437

我在应用程序中绝对不使用 native 代码。

可能是什么原因?

我曾尝试在我的代码中关闭硬件加速,但这没有帮助。当我试图打开联系人列表时发生崩溃。我的联系人列表只有 3 张图片,而且它们的大小都在几十 KB。

最后,这是加载位图的代码:

public static Bitmap decodeSampledBitmapFromFile(File data,
int reqWidth, int reqHeight) {

// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(data.getAbsolutePath(), options);

// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth,
reqHeight);

// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(data.getAbsolutePath(), options);
}

是什么导致了这次崩溃?

更新

我注意到系统似乎内存不足或可能是 native 代码中发生某些事情的结果?

    01-23 10:30:31.561 2106-2121/? I/art: Background sticky concurrent mark

sweep GC freed 7418(355KB) AllocSpace objects, 3(48KB) LOS objects, 1% free,

21MB/21MB, paused 7.940ms total 40.757ms

更新

我在使用 Android 6.0 MarshMallow 的 Infinix X510 上运行该应用程序,但出现错误:

01-23 20:13:12.418 5592-5600/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 5600 (FinalizerDaemon)
01-23 20:13:12.474 5695-5695/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-23 20:13:12.474 5695-5695/? A/DEBUG: Build fingerprint: 'Infinix/Infinix_X510/Infinix_X510_sprout:6.0/MRA58K/1452855576:user/release-keys'
01-23 20:13:12.474 5695-5695/? A/DEBUG: Revision: '0'
01-23 20:13:12.475 5695-5695/? A/DEBUG: ABI: 'arm'
01-23 20:13:12.475 5695-5695/? A/DEBUG: pid: 5592, tid: 5600, name: FinalizerDaemon >>> supernet.interactapp <<<
01-23 20:13:12.475 5695-5695/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0
01-23 20:13:12.499 5695-5695/? A/DEBUG: r0 afa193c0 r1 afa193a0 r2 00000000 r3 00000000
01-23 20:13:12.499 5695-5695/? A/DEBUG: r4 ae67bfe0 r5 00000001 r6 ffffffff r7 ffffffff
01-23 20:13:12.499 5695-5695/? A/DEBUG: r8 00000000 r9 ab5de800 sl 00000000 fp 12e69e40
01-23 20:13:12.499 5695-5695/? A/DEBUG: ip b5c804b4 sp b3c5e528 lr b6e9add7 pc 00000000 cpsr 40070010
01-23 20:13:12.500 5695-5695/? E/AEE/LIBAEE: aee_try_get_word: read:5600 addr:0x00000000 ret:-1, 5
01-23 20:13:12.503 5695-5695/? A/DEBUG: #00 pc 00000000 <unknown>
01-23 20:13:12.503 5695-5695/? A/DEBUG: #01 pc 0008fdd5 /system/lib/libandroid_runtime.so (android::Bitmap::~Bitmap()+20)
01-23 20:13:12.503 5695-5695/? A/DEBUG: #02 pc 0008fdff /system/lib/libandroid_runtime.so (android::Bitmap::detachFromJava()+30)
01-23 20:13:12.503 5695-5695/? A/DEBUG: #03 pc 72a75785 /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x23a4000)
01-23 20:13:12.808 5695-5695/? E/DEBUG: waitpid failed: tid 5592, No child processes

堆栈跟踪:

01-23 20:13:21.458 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 676, h 931, sample 1, bsLength 99cf!!
01-23 20:13:21.459 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 676, h 931, sample 1, bsLength 99cf!!
01-23 20:13:21.459 5699-5699/? D/skia: jpeg_decoder mode 1, colorType 4, w 676, h 931, sample 8, bsLength 99cf!!
01-23 20:13:21.543 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 1914, h 1076, sample 1, bsLength 28d55!!
01-23 20:13:21.544 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 1914, h 1076, sample 1, bsLength 28d55!!
01-23 20:13:21.544 5699-5699/? D/skia: jpeg_decoder mode 1, colorType 4, w 1914, h 1076, sample 32, bsLength 28d55!!
01-23 20:13:21.605 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 571, h 559, sample 1, bsLength a716!!
01-23 20:13:21.605 5699-5699/? D/skia: jpeg_decoder mode 0, colorType 4, w 571, h 559, sample 1, bsLength a716!!
01-23 20:13:21.605 5699-5699/? D/skia: jpeg_decoder mode 1, colorType 4, w 571, h 559, sample 8, bsLength a716!!

01-23 20:13:29.093 5699-5708/? E/AndroidRuntime: FATAL EXCEPTION: FinalizerWatchdogDaemon
Process: supernet.interactapp, PID: 5699
java.util.concurrent.TimeoutException: android.graphics.Bitmap$BitmapFinalizer.finalize() timed out after 10 seconds
at android.graphics.Bitmap.nativeDestructor(Native Method)
at android.graphics.Bitmap.-wrap1(Bitmap.java)
at android.graphics.Bitmap$BitmapFinalizer.finalize(Bitmap.java:1667)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:212)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:191)
at java.lang.Thread.run(Thread.java:818)

最佳答案

加载位图时,您是否检查设备的内存?我知道您正在计算 inSampleSize,但我遇到了同样的问题,因为我将错误的值传递给参数 reqWidth 和 reqHeight,当然,inSampleSize 太大并导致设备内存崩溃。这个问题出现在照片库中。

希望对您有所帮助!!

关于java - 运行 Android KitKat 代码在 Lollipop 设备上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34939888/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com