什么是#34;致命信号6(SIGABRT),代码-6在tid 13300(RenderThread)"?

时间:2017-10-06 11:47:40

标签: android fragment fatal-error sigabrt

这是我的第一篇帖子!

我从我的应用中收到错误,特别是一个片段

E/RecyclerView: No adapter attached; skipping layout
I/Choreographer: Skipped 20 frames!  The application may be doing too much work on its main thread.
E/OpenGLRenderer: GL error:  GL_INVALID_VALUE
A/OpenGLRenderer: GL errors! frameworks/base/libs/hwui/BakedOpRenderer.cpp:67
W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
W/google-breakpad: Chrome build fingerprint:
W/google-breakpad: 1.0.1
W/google-breakpad: 2
W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 16473 (RenderThread)

                                      [ 10-06 13:57:41.108   404:  404 W/         ]
                                      debuggerd: handling request: pid=16353 uid=10401 gid=10401 tid=16473

我试图找出解决方法。 我注意到当适配器(MatchAdapter)被ArrayList中的超过35个项填充时会发生这种情况

在我看来,错误发生在

endedMatches.add( new EndedMatch(n, "Prova - Prova", "01/12/17 20.15", "Prova", "Prova", false ) );

位于此代码段的底部。您可能会注意到我使用的是Firebase。

我该如何解决?

//updates the tips list
private void initChildEventListener() {

    mChildEventListener = new ChildEventListener() {
        @Override
        public void onChildAdded(DataSnapshot dataSnapshot, String s) {

            //update the matches shown to the user
            updateMatchList(dataSnapshot);

        }

        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) {

            //update the matches shown to the user
            updateMatchList(dataSnapshot);

        }

        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) {

            //update the list
            endedMatches.remove( dataSnapshot.getValue(EndedMatch.class) );
            updateAdapter();

        }

        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) {

            //update the matches shown to the user
            updateMatchList(dataSnapshot);

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            Toast.makeText(getActivity().getApplicationContext(), getString(R.string.error_retriving_data), Toast.LENGTH_SHORT).show();
        }

        //updates the tipsList
        private void updateMatchList(DataSnapshot dataSnapshot){

            EndedMatch child = dataSnapshot.getValue(EndedMatch.class);

            //remove all occurences of em
            endedMatches.removeAll(Collections.singleton(child));


            //adds the new match in the list
            endedMatches.add(child);

            //sort the tip list
            Collections.sort(endedMatches);

            //show result
            updateAdapter();

        }

        //updates the adapter
        private void updateAdapter(){

            if(endedMatches.size()>=0){
                matchAdapter = new MatchAdapter(getContext(), R.layout.list_item_pronostico, endedMatches);
                tipsListView.setAdapter(matchAdapter);

                //Toast.makeText( getActivity().getApplicationContext() , "Lista aggiornata!", Toast.LENGTH_SHORT).show();
            }
            else{
                //Toast.makeText( getActivity().getApplicationContext(), "No data", Toast.LENGTH_SHORT).show();
            }


//*** dummy data to cause the crash ****

//there are 34 items on the database

            if(endedMatches.size()>33){

                int n=40;
                for(int n = 40; n<50; n++){
                    endedMatches.add( new EndedMatch(n, "Prova - Prova", "01/12/17 20.15", "Prova", "Prova", false ) );
                }
            }

*** end of dummy data ***


        }
    };


    mEndedMatchReference.addChildEventListener(mChildEventListener);
}

在onCreateView方法中:

//initialize the tips list
    this.endedMatches = new ArrayList<>();

    //initialize an empty adapter
    matchAdapter = new MatchAdapter(getContext(), R.layout.list_item_pronostico);


    //initialize the child event listener
    initChildEventListener();

0 个答案:

没有答案