App keeps crashing when Android profiler is used

My app is doing some location tracking and update database when needed, the app has been running 2 days without having any issue. And now I am trying to use the Android Profiler (Android Studio 3.01), however, as soon as I turn it, it runs for few seconds and then it starts crashing the app. Anyone has an idea?

10-22 21:31:01.236 16471-16471/myproject.myfirstapp A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 16471 (ampaigns.myfirstapp), pid 16471 (ampaigns.myfirstapp)
10-22 21:31:01.358 16585-16585/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-22 21:31:01.358 16585-16585/? A/DEBUG: Build fingerprint: 'google/taimen/taimen:9/PPR2.181005.003/4984323:user/release-keys'
10-22 21:31:01.358 16585-16585/? A/DEBUG: Revision: 'rev_10'
10-22 21:31:01.358 16585-16585/? A/DEBUG: ABI: 'arm64'
10-22 21:31:01.358 16585-16585/? A/DEBUG: pid: 16471, tid: 16471, name: ampaigns.myfirstapp  >>> myproject.myfirstapp <<<
10-22 21:31:01.358 16585-16585/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10-22 21:31:01.358 16585-16585/? A/DEBUG:     x0  0000000000000000  x1  0000000000004057  x2  0000000000000006  x3  0000000000000008
10-22 21:31:01.358 16585-16585/? A/DEBUG:     x4  000000000000000a  x5  000000000000000a  x6  000000000000000a  x7  000000000000000a
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x8  0000000000000083  x9  00000077c95b99d8  x10 fffffff87ffffbdf  x11 0000000000000001
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x12 0000000000000064  x13 0000000000000000  x14 00000000ffffffff  x15 0000007fdd2337b8
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x16 00000077c95f22c8  x17 00000077c95302d8  x18 0000007fdd23313a  x19 0000000000004057
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x20 0000000000004057  x21 0000000000000083  x22 0000000004000000  x23 0000000000000000
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x24 000000773f7f1640  x25 0000007fdd233b38  x26 0000000000000000  x27 000000773f7f1640
10-22 21:31:01.359 16585-16585/? A/DEBUG:     x28 0000007747a6d460  x29 0000007fdd233800
10-22 21:31:01.359 16585-16585/? A/DEBUG:     sp  0000007fdd2337c0  lr  00000077c9524a90  pc  00000077c9524abc
10-22 21:31:01.606 16585-16585/? A/DEBUG: backtrace:
10-22 21:31:01.606 16585-16585/? A/DEBUG:     #00 pc 0000000000021abc  /system/lib64/libc.so (abort+124)
10-22 21:31:01.606 16585-16585/? A/DEBUG:     #01 pc 0000000000066ad4  /data/data/myproject.myfirstapp/libperfa_arm64.so
10-22 21:31:01.606 16585-16585/? A/DEBUG:     #02 pc 0000000000072c48  /data/data/myproject.myfirstapp/libperfa_arm64.so
10-22 21:31:01.606 16585-16585/? A/DEBUG:     #03 pc 0000000000072890  /data/data/myproject.myfirstapp/libperfa_arm64.so
10-22 21:31:01.606 16585-16585/? A/DEBUG:     #04 pc 0000000000052058  /data/data/myproject.myfirstapp/libperfa_arm64.so
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #05 pc 00000000000910b0  /system/lib64/libopenjdkjvmti.so (_ZN12openjdkjvmti11Transformer26TransformSingleClassDirectILNS_13ArtJvmtiEventE85EEEvPNS_12EventHandlerEPN3art6ThreadEPNS_18ArtClassDefinitionE+1864)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #06 pc 0000000000091c48  /system/lib64/libopenjdkjvmti.so (openjdkjvmti::Transformer::RetransformClasses(openjdkjvmti::ArtJvmTiEnv*, openjdkjvmti::EventHandler*, art::Runtime*, art::Thread*, int, _jclass* const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*)+768)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #07 pc 0000000000039f90  /system/lib64/libopenjdkjvmti.so (openjdkjvmti::JvmtiFunctions::RetransformClasses(_jvmtiEnv*, int, _jclass* const*)+192)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #08 pc 0000000000053e40  /data/data/myproject.myfirstapp/libperfa_arm64.so
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #09 pc 00000000004b2828  /system/lib64/libart.so (art::ti::AgentSpec::DoLoadHelper(_JNIEnv*, bool, _jobject*, int*, art::ti::LoadError*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*)+832)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #10 pc 00000000004b2e78  /system/lib64/libart.so (art::ti::AgentSpec::Attach(_JNIEnv*, _jobject*, int*, art::ti::LoadError*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*)+120)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #11 pc 0000000000476c30  /system/lib64/libart.so (art::Runtime::AttachAgent(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, _jobject*)+1312)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #12 pc 00000000003d325c  /system/lib64/libart.so (art::VMDebug_nativeAttachAgent(_JNIEnv*, _jclass*, _jstring*, _jobject*)+1908)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #13 pc 0000000000079a48  /system/framework/arm64/boot-core-libart.oat (offset 0x78000) (dalvik.system.VMDebug.nativeAttachAgent [DEDUPED]+200)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #14 pc 000000000055cc4c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #15 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #16 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #17 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #18 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #19 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #20 pc 000000000018fa0c  /system/framework/boot-core-libart.vdex (dalvik.system.VMDebug.attachAgent)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #21 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #22 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #23 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #24 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #25 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #26 pc 00000000004b5f4a  /system/framework/boot-framework.vdex (android.app.ActivityThread.attemptAttachAgent)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #27 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #28 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #29 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #30 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #31 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #32 pc 00000000004b7eca  /system/framework/boot-framework.vdex (android.app.ActivityThread.handleAttachAgent+18)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #33 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #34 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #35 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #36 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #37 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #38 pc 000000000037f02e  /system/framework/boot-framework.vdex (android.app.ActivityThread$H.handleMessage+222)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #39 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #40 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #41 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #42 pc 000000000052c3d8  /system/lib64/libart.so (MterpInvokeVirtual+584)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #43 pc 000000000054f094  /system/lib64/libart.so (ExecuteMterpImpl+14228)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #44 pc 0000000000ae3442  /system/framework/boot-framework.vdex (android.os.Handler.dispatchMessage+42)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #45 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #46 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #47 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.607 16585-16585/? A/DEBUG:     #48 pc 000000000052c3d8  /system/lib64/libart.so (MterpInvokeVirtual+584)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #49 pc 000000000054f094  /system/lib64/libart.so (ExecuteMterpImpl+14228)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #50 pc 0000000000aea530  /system/framework/boot-framework.vdex (android.os.Looper.loop+404)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #51 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #52 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #53 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #54 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #55 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #56 pc 0000000000384a52  /system/framework/boot-framework.vdex (android.app.ActivityThread.main+214)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #57 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #58 pc 000000000051cb18  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #59 pc 0000000000565afc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #60 pc 000000000055cc4c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #61 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #62 pc 00000000004633b8  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #63 pc 0000000000464e10  /system/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1440)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #64 pc 00000000003f43b0  /system/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #65 pc 000000000011e6d4  /system/framework/arm64/boot.oat (offset 0x114000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+180)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #66 pc 000000000055c988  /system/lib64/libart.so (art_quick_invoke_stub+584)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #67 pc 00000000000cf740  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #68 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #69 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #70 pc 000000000052c3d8  /system/lib64/libart.so (MterpInvokeVirtual+584)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #71 pc 000000000054f094  /system/lib64/libart.so (ExecuteMterpImpl+14228)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #72 pc 0000000000c0b2f6  /system/framework/boot-framework.vdex (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #73 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2146680767+496)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #74 pc 000000000051cb18  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #75 pc 0000000000565afc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #76 pc 0000000000bea920  /system/framework/arm64/boot-framework.oat (offset 0x3cd000) (com.android.internal.os.ZygoteInit.main+3088)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #77 pc 000000000055cc4c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #78 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #79 pc 00000000004633b8  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #80 pc 0000000000463010  /system/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+416)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #81 pc 0000000000366854  /system/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+644)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #82 pc 00000000000b1bf8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+120)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #83 pc 00000000000b4578  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+760)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #84 pc 00000000000021a0  /system/bin/app_process64 (main+1200)
10-22 21:31:01.608 16585-16585/? A/DEBUG:     #85 pc 00000000000ae760  /system/lib64/libc.so (__libc_init+88)

Solution 1:

It perhaps an android studio profile bug. Delete the whole codecache directory in your application data package root path(data/data/pacakge_name/codecache) and retry profile again.

Solution 2:

In Android Studio 4.0 (or higher), the following is the navigation to avoid crashes when running with profiler:

1. From menu click on "Run"
2. Profile 'app'