Android原生崩溃

时间:2017-11-01 20:26:40

标签: android crash native

我们没有使用任何本机代码,我们的应用程序也没有任何本机传递依赖。

在最近发布之后(我们更新了几个依赖项并添加了新内容),我们开始在Google Play中看到这样的崩溃:

native: pc 000000000006a548  /system/lib64/libc.so (tgkill+8)
  native: pc 0000000000067cd8  /system/lib64/libc.so (pthread_kill+68)
  native: pc 0000000000024b78  /system/lib64/libc.so (raise+28)
  native: pc 000000000001f318  /system/lib64/libc.so (abort+60)
  native: pc 000000000043471c  /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+324)
  native: pc 0000000000137224  /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136)
  native: pc 000000000030d988  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+2080)
  native: pc 000000000030df24  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224)
  native: pc 000000000034ec64  /system/lib64/libart.so (_ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+616)
  native: pc 0000000000099094  /system/lib64/libandroid_runtime.so
  native: pc 0000000002a71ac4  /system/framework/arm64/boot.oat

我认为这只是Android本身但可能是什么原因?任何帮助表示赞赏。

是否有关于此通话意味着什么的信息?这是虚拟机的一些调用吗?

_ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list

2 个答案:

答案 0 :(得分:4)

首先,我认为麻烦的问题是找到根本原因,因为Play Console不提供完整的堆栈跟踪,堆栈跟踪也会根据设备/ android版本略有变化。我看到这个tgkill本机崩溃有很多变化,如下所示,但我得出的结论是,所有这些崩溃都可以归结为bug in the Support Library

_ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+440 _ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+616 art::JNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+580 _ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+470 _ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+560

经过多方努力,我能够在我的应用程序的屏幕上的6.0设备上重新创建它,其中包含AppBarLayout + CollapsingToolbarLayout + RecyclerView。 CollapsingToolbarLayout具有以下滚动标志

app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"

通过一直滚动到底部然后快速回到顶部我能够在大部分时间重新创建崩溃,从而产生以下堆栈跟踪

04-18 14:06:53.814 27077-27077/com.PACKAGE.NAME.debug A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setElevation(float) on null object
art/runtime/java_vm_ext.cc:410]     in call to CallVoidMethodV
art/runtime/java_vm_ext.cc:410]     from void android.animation.PropertyValuesHolder.nCallFloatMethod(java.lang.Object, long, float)
art/runtime/java_vm_ext.cc:410] "main" prio=5 tid=1 Runnable
art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x740f26e8 self=0x558c24bf70
art/runtime/java_vm_ext.cc:410]   | sysTid=27077 nice=-6 cgrp=default sched=0/0 handle=0x7f8f6e8fc8
art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 76543056125 12869243427 123563 ) utm=6830 stm=824 core=2 HZ=100
art/runtime/java_vm_ext.cc:410]   | stack=0x7fef761000-0x7fef763000 stackSize=8MB
art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
art/runtime/java_vm_ext.cc:410]   native: #00 pc 00000000004903d8  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+236)
art/runtime/java_vm_ext.cc:410]   native: #01 pc 000000000045f598  /system/lib64/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+220)
art/runtime/java_vm_ext.cc:410]   native: #02 pc 0000000000312970  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1000)
art/runtime/java_vm_ext.cc:410]   native: #03 pc 0000000000313228  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+116)
art/runtime/java_vm_ext.cc:410]   native: #04 pc 000000000014501c  /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+144)
art/runtime/java_vm_ext.cc:410]   native: #05 pc 000000000014557c  /system/lib64/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+1084)
art/runtime/java_vm_ext.cc:410]   native: #06 pc 000000000015eaf8  /system/lib64/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+724)
art/runtime/java_vm_ext.cc:410]   native: #07 pc 0000000000160d98  /system/lib64/libart.so (_ZN3art8CheckJNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+68)
art/runtime/java_vm_ext.cc:410]   native: #08 pc 0000000000098fe0  /system/lib64/libandroid_runtime.so (???)
art/runtime/java_vm_ext.cc:410]   native: #09 pc 0000000000ad2cc4  /system/framework/arm64/boot.oat (Java_android_animation_PropertyValuesHolder_nCallFloatMethod__Ljava_lang_Object_2JF+168)
art/runtime/java_vm_ext.cc:410]   at android.animation.PropertyValuesHolder.nCallFloatMethod(Native method)
art/runtime/java_vm_ext.cc:410]   at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:37)
art/runtime/java_vm_ext.cc:410]   at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1296)
art/runtime/java_vm_ext.cc:410]   at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:981)
art/runtime/java_vm_ext.cc:410]   at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1384)
art/runtime/java_vm_ext.cc:410]   at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1427)
art/runtime/java_vm_ext.cc:410]   at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:759)
art/runtime/java_vm_ext.cc:410]   at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
art/runtime/java_vm_ext.cc:410]   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
art/runtime/java_vm_ext.cc:410]   at android.view.Choreographer.doCallbacks(Choreographer.java:670)
art/runtime/java_vm_ext.cc:410]   at android.view.Choreographer.doFrame(Choreographer.java:603)
art/runtime/java_vm_ext.cc:410]   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
art/runtime/java_vm_ext.cc:410]   at android.os.Handler.handleCallback(Handler.java:743)
art/runtime/java_vm_ext.cc:410]   at android.os.Handler.dispatchMessage(Handler.java:95)
art/runtime/java_vm_ext.cc:410]   at android.os.Looper.loop(Looper.java:171)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.main(ActivityThread.java:5417)
art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
art/runtime/java_vm_ext.cc:410] 

此根本原因似乎与详细herehere

支持库错误有关

<强>解

在我的情况下,我所要做的就是删除snap滚动标记和滚动更改。通过该更改,我在Play Console中不再看到任何这些本机崩溃。

在其他情况下,如果您在AppBarLayout上使用StateListAnimator,可以尝试this

答案 1 :(得分:1)

我对某些依赖性错误持怀疑态度,因为这可能是造成崩溃的原因。

但是,我们在最新版本中接下来更新了,崩溃消失了:

  • 构建工具26.0.3 - &gt; 27.0.3
  • Android Gradle Plugin to 3.0.1 - &gt; 3.1.0-rc01(这也带来了新的数据绑定依赖关系)
  • DexGuard 8.0.23 - &gt; 8.1.10
  • Kotlin 1.2.21 - &gt; 1.2.30
  • RxJava 2.1.0 - &gt; 2.1.10
  • RxAndroid 2.0.1 - &gt; 2.0.2
  • 调整4.12.1 - &gt; 4.12.2
  • Multidex支持1.0.2 - &gt; 1.0.3

分析CHANGELOGS非常困难和繁琐。我花了半个小时就没有指出一个明显的问题。

经过一遍又一遍的审核,我认为这可能是依赖性错误。但我不能肯定地说,因为我们在这两周内也做了很多改变。