是什么原因导致android.gms.dynamite_mapsdynamite出现DeadSystemException?

时间:2019-06-01 12:58:29

标签: android google-maps google-play-services google-maps-android-api-2

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

  • 只有HockeyApp报告这些崩溃,而Firebase Crashlytics则不报告。
  • 据报道,相对较少的用户崩溃发生了数百次,因此似乎影响了某些类型的用户。
  • 在各种设备(华为,LG,三星等)上出现在一系列Android版本(7.0、8.0、8.1、9)上。
  • 总是报告与地图有关的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_width="@dimen/_100sdp"
    android:layout_height="@dimen/_100sdp"
    android:visibility="gone"
    map:liteMode="true"
    map:mapType="none" />

View Holder(简体):

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 个答案:

答案 0 :(得分:0)

我也已经开始在我的App中看到这一点,但是决定,对此不能做太多事情。根据{{​​3}}的意思是:

  

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

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

这表示,除非您考虑,否则应用程序本身会导致Android系统死亡,但是您可能必须在其他地方搜索。内存泄漏,本机组件等。