是啥导致 android.gms.dynamite_mapsdynamite 出现 DeadSystemException?

Posted

技术标签:

【中文标题】是啥导致 android.gms.dynamite_mapsdynamite 出现 DeadSystemException?【英文标题】:What causes DeadSystemException with android.gms.dynamite_mapsdynamite?是什么导致 android.gms.dynamite_mapsdynamite 出现 DeadSystemException? 【发布时间】:2019-10-17 19:19:35 【问题描述】:

与显示在回收站视图保持器中的 Google 地图(精简模式)有关的大量崩溃报告。

只有 HockeyApp 会报告这些崩溃,Firebase Crashlytics 不会。 对于数量相对较少的用户,崩溃报告了数百次,因此它似乎影响了特定类型的用户。 出现在一系列 android 版本(7.0、8.0、8.1、9)上,适用于各种设备(华为、LG、三星等)。 DeadSystemException 始终与地图相关联,因此我会排除设备因其他原因而关闭。 在没有安装 Google Play 服务的模拟器上测试,没有崩溃;然后地图视图显示预期的错误消息MyApp won't run without Google Play services, which are not supported by your device.

堆栈跟踪看起来略有不同,具体取决于设备。

对于华为:

java.lang.RuntimeException: android.os.DeadSystemException
    at huawei.android.app.HwApiCacheMangerEx.getApplicationInfoAsUser(HwApiCacheMangerEx.java:145)
    at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:417)
    at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:409)
    at pt.a(:com.google.android.gms.dynamite_mapsdynamite@17122079@17.1.22 (100306-245988633):3)
    at com.google.maps.api.android.lib6.drd.r.b(:com.google.android.gms.dynamite_mapsdynamite@17122079@17.1.22 (100306-245988633):15)
    at com.google.maps.api.android.lib6.impl.fl.a(:com.google.android.gms.dynamite_mapsdynamite@17122079@17.1.22 (100306-245988633):50)
    at com.google.maps.api.android.lib6.impl.fk.a(:com.google.android.gms.dynamite_mapsdynamite@17122079@17.1.22 (100306-245988633):4)
    at com.google.maps.api.android.lib6.impl.fm.run(:com.google.android.gms.dynamite_mapsdynamite@17122079@17.1.22 (100306-245988633):4)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:784)
Caused by: android.os.DeadSystemException
    ... 11 more

三星:

java.lang.RuntimeException: android.os.DeadSystemException
    at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:264)
    at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:237)
    at pt.b(:com.google.android.gms.dynamite_mapsdynamite@17122081@17.1.22 (100400-245988633):4)
    at com.google.android.gms.maps.internal.CreatorImpl.a(:com.google.android.gms.dynamite_mapsdynamite@17122081@17.1.22 (100400-245988633):58)
    at com.google.android.gms.maps.internal.CreatorImpl.newMapViewDelegate(:com.google.android.gms.dynamite_mapsdynamite@17122081@17.1.22 (100400-245988633):29)
    at com.google.android.gms.maps.internal.h.a(:com.google.android.gms.dynamite_mapsdynamite@17122081@17.1.22 (100400-245988633):62)
    at hj.onTransact(:com.google.android.gms.dynamite_mapsdynamite@17122081@17.1.22 (100400-245988633):4)
    at android.os.Binder.transact(Binder.java:675)
    at com.google.android.gms.internal.maps.zza.a(zza.java:7)
    at com.google.android.gms.maps.internal.zzf.a(zzf.java:11)
    at com.google.android.gms.maps.MapView$zzb.a(MapView.java:31)
    at com.google.android.gms.dynamic.DeferredLifecycleHelper.a(DeferredLifecycleHelper.java:44)
    at com.google.android.gms.dynamic.DeferredLifecycleHelper.a(DeferredLifecycleHelper.java:5)
    at com.google.android.gms.maps.MapView.a(MapView.java:22)
    at com.myapp.myapp.viewholder.MyViewHolder.E(MyViewHolder.java:3)
    at com.myapp.myapp.viewholder.MyViewHolder.A(MyViewHolder.java:6)
    at com.myapp.myapp.viewholder.MyViewHolder.<init>(MyViewHolder.java:159)
    at com.myapp.myapp.activities.MyActivity$18.a(MyActivity.java:55)
    at com.myapp.myapp.adapter.MyAdapter.a(MyAdapter.java:8)
    at android.support.v7.widget.RecyclerView$Adapter.b(RecyclerView.java:5)
    at android.support.v7.widget.RecyclerView$Recycler.a(RecyclerView.java:293)
    at android.support.v7.widget.RecyclerView$Recycler.a(RecyclerView.java:5)
    at android.support.v7.widget.RecyclerView$Recycler.c(RecyclerView.java:1)
    at android.support.v7.widget.LinearLayoutManager$LayoutState.a(LinearLayoutManager.java:11)
    at android.support.v7.widget.LinearLayoutManager.generateDefaultLayoutParams(LinearLayoutManager.java:0)
        onDetachedFromWindow(LinearLayoutManager.java:0)
        onInitializeAccessibilityEvent(LinearLayoutManager.java:0)
        onRestoreInstanceState(LinearLayoutManager.java:0)
        setStackFromEnd(LinearLayoutManager.java:0)
        smoothScrollToPosition(LinearLayoutManager.java:0)
        onLayoutCompleted(LinearLayoutManager.java:0)
        onAnchorReady(LinearLayoutManager.java:0)
        updateAnchorInfoForLayout(LinearLayoutManager.java:0)
        updateAnchorFromPendingData(LinearLayoutManager.java:0)
        fixLayoutEndGap(LinearLayoutManager.java:0)
        updateLayoutStateToFillEnd(LinearLayoutManager.java:0)
        scrollHorizontallyBy(LinearLayoutManager.java:0)
        updateLayoutState(LinearLayoutManager.java:0)
        collectPrefetchPositionsForLayoutState(LinearLayoutManager.java:0)
        collectInitialPrefetchPositions(LinearLayoutManager.java:0)
        collectAdjacentPrefetchPositions(LinearLayoutManager.java:0)
        assertNotInLayoutOrScroll(LinearLayoutManager.java:0)
        recycleChildren(LinearLayoutManager.java:0)
        recycleViewsFromStart(LinearLayoutManager.java:0)
        recycleByLayoutState(LinearLayoutManager.java:0)
        fill(LinearLayoutManager.java:0)
        layoutChunk(LinearLayoutManager.java:0)
        findFirstVisibleChildClosestToStart(LinearLayoutManager.java:0)
        findReferenceChild(LinearLayoutManager.java:0)
        findOneVisibleChild(LinearLayoutManager.java:0)
        onFocusSearchFailed(LinearLayoutManager.java:0)
        prepareForDrop(LinearLayoutManager.java:0)
    at android.support.v7.widget.LinearLayoutManager.a(LinearLayoutManager.java:44)
    at android.support.v7.widget.LinearLayoutManager.c(LinearLayoutManager.java:394)
    at android.support.v7.widget.RecyclerView.O(RecyclerView.java:38)
    at android.support.v7.widget.RecyclerView.q(RecyclerView.java:37)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:5)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.support.design.widget.CoordinatorLayout.d(CoordinatorLayout.java:143)
    at android.support.design.widget.CoordinatorLayout.a(CoordinatorLayout.java:32)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:48)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at com.android.internal.policy.DecorView.onLayout(DecorView.java:1041)
    at android.view.View.layout(View.java:22407)
    at android.view.ViewGroup.layout(ViewGroup.java:6579)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3357)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2826)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1874)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8491)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
    at android.view.Choreographer.doCallbacks(Choreographer.java:761)
    at android.view.Choreographer.doFrame(Choreographer.java:696)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7058)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Caused by: android.os.DeadSystemException
    ... 84 more

地图是这样实现的:

视图支架布局(简化):

<com.google.android.gms.maps.MapView
    android:id="@+id/map"
    android:layout_
    android:layout_
    android:visibility="gone"
    map:liteMode="true"
    map:mapType="none" />

视图支架(简体):

public class MyHolder extends RecyclerView.ViewHolder implements OnMapReadyCallback 

    private @NonNull MapView mapView;
    private @Nullable Location location;

    public MyHolder(@NonNull View itemView) 
        super(itemView);

        mapView = itemView.findViewById(R.id.map);
        mapView.onCreate(null);
        mapView.getMapAsync(this);

        LocalBroadcastManager.getInstance(App.getInstance().getApplicationContext()).registerReceiver(broadcastReceiver, new IntentFilter(MyFilter));
    

    // Called when the view holder is recycled
    public void recycle() 

        mapView.setVisibility(View.GONE);
        releaseMap();
    

    // Called when binding the view holder or by the broadcast receiver
    public void update(@NonNull Location location) 
        this.location = location;

        mapView.setVisibility(View.VISIBLE);
        setMapLocation();
    

    @Override
    public void onMapReady(GoogleMap googleMap) 

        MapsInitializer.initialize(App.getInstance().getApplicationContext());
        map = googleMap;
        map.getUiSettings().setMapToolbarEnabled(false);
        map.getUiSettings().setAllGesturesEnabled(false);

        setMapLocation();
    

    private void setMapLocation() 

        if (map == null) 
            return;
        

        if (location == null) 
            map.setMapType(GoogleMap.MAP_TYPE_NONE);
            return;
        

        LatLng mapLocation = new LatLng(location.getLatitude(), location.getLongitude());
        map.addMarker(new MarkerOptions().position(mapLocation));
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(mapLocation, 14f));
        map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    

    private void releaseMap() 

        if (map == null) 
            return;
        

        map.clear();
        map.setMapType(GoogleMap.MAP_TYPE_NONE);
    

    private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() 
        @Override
        public void onReceive(Context context, Intent intent) 

            update();
        
    ;

这可能是什么原因?

【问题讨论】:

【参考方案1】:

我也开始在我的应用程序中看到这一点,但我决定,对此无能为力。根据https://developer.android.com/reference/android/os/DeadSystemException 表示:

核心 Android 系统已死亡,正在运行运行时 重新开始。所有正在运行的应用程序将被立即终止。

实际上,这意味着您的应用程序经常在内存中,这可能意味着用户喜欢它。使用我的应用程序,在开始与 Android 内存清理(即Application.onTrimMemory()Activity.onTrimMemory())交互后,我开始得到这些,因为这应该使应用程序的(核心)在内存中保留更长时间。

这就是说,除非您考虑到,您的应用本身会导致 Android 系统死机,但您可能不得不在其他地方进行搜索。内存泄漏、原生组件等。

【讨论】:

您知道如何让 Firebase Crashlytics 忽略它吗?在网站上尝试,它只是一直显示为一个新的。尝试使用Thread.setDefaultUncaughtExceptionHandler 然后识别它(然后只在不是它的情况下才调用你得到的东西)由于某种原因对我来说失败了

以上是关于是啥导致 android.gms.dynamite_mapsdynamite 出现 DeadSystemException?的主要内容,如果未能解决你的问题,请参考以下文章

未找到可接受的模块。 FaceDetector.Builder中本地版本为0,远程版本为0

是啥导致 HttpHostConnectException?

是啥导致此 BadDeviceToken 响应?

是啥导致了这个推进错误?

是啥导致了 NSInvalidArgumentException?

是啥导致移动构造函数被删除