Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Android Native crash log (perhaps multiple webview issue)? [duplicate]

I got a crash that I couldn't find linked directly to my code, then I found that it is a native crash. The backtrace is like this

Abort message: '[FATAL:jni_android.cc(259)] Please include Java exception stack in crash report
    '
        r0 00000000  r1 00003c12  r2 00000006  r3 00000008
        r4 7cb80978  r5 00000006  r6 7cb80920  r7 0000010c
        r8 7cb7ffad  r9 7cb7ffac  sl 7cb80408  fp 7cb80404
        ip 0000000b  sp 7cb7ff38  lr b3eab4b7  pc b3eadd20  cpsr 600f0010

A/DEBUG: backtrace:
        #00 pc 0004ad20  /system/lib/libc.so (tgkill+12)
        #01 pc 000484b3  /system/lib/libc.so (pthread_kill+34)
        #02 pc 0001dd89  /system/lib/libc.so (raise+10)
        #03 pc 00019511  /system/lib/libc.so (__libc_android_abort+34)
        #04 pc 00017150  /system/lib/libc.so (abort+4)
        #05 pc 0079a29b  /data/app/com.android.chrome-1/base.apk (offset 0xfa5000)

I'm wondering how can I utilize this to help me locate my problem. I know this is too broad, difficult to locate the problem in my code. So I'm wondering if anyone can give any instruction or direction to utilize this log? To give more information, I have multiple webviews when it crashes, is it possible of memory fragmentation error? If so, what should I do? Recreate webview? Seems there are something before this

System.err: java.lang.IllegalStateException: get field slot from row 25 col 46 failed
        at net.sqlcipher.CursorWindow.getLong_native(Native Method)
05-29 15:38:24.016 22757-23608/com.boxer.email W/System.err:     at net.sqlcipher.CursorWindow.getLong(CursorWindow.java:450)
        at net.sqlcipher.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:110)
        at net.sqlcipher.AbstractCursor.moveToPosition(AbstractCursor.java:201)
        at net.sqlcipher.AbstractCursor.moveToNext(AbstractCursor.java:230)
05-29 15:38:24.017 22757-23608/com.boxer.email W/System.err:     at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
        at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
        at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
        at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
like image 579
litaoshen Avatar asked May 25 '18 13:05

litaoshen


2 Answers

try to destroy webview in onDestroy() method because WebView Client or Chromium client is loading data even after your activity or fragment destroyed.

try this :

@Override
protected void onDestroy() {
    if (myWbView != null)
        myWbView.destroy();
    super.onDestroy();
}

OR

@Override
public void onDestroyView() {
    super.onDestroyView();
    webView=null; // remove webView, prevent chromium to crash
}
like image 85
Rutvik Bhatt Avatar answered Nov 01 '22 06:11

Rutvik Bhatt


If you have file with symbols consider using ndk-stack Sample usage: adb logcat | ~/Library/Android/android-ndk-r17/ndk-stack -sym /armeabi-v7a/

this would show functions where crash is.

Official link:https://developer.android.com/ndk/guides/ndk-stack

like image 1
Stakshi Avatar answered Nov 01 '22 06:11

Stakshi