Logcat报错:Skipped 55 frames!  The application may be doing too much work on its main thread.
错误详情:A/art: art/runtime/indirect_reference_table.cc:116] JNI ERROR (app bug): weak global reference table overflow (max=51200)
    art/runtime/indirect_reference_table.cc:116] weak global reference table dump:
    art/runtime/indirect_reference_table.cc:116]   Last 10 entries (of 51200):
    art/runtime/indirect_reference_table.cc:116]     51199: 0x17baa160 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51198: 0x17baa190 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51197: 0x17baa760 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51196: 0x17baa778 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51195: 0x17baac58 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51194: 0x17baad78 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51193: 0x17b9c298 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51192: 0x17b9c328 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51191: 0x17b9c7a8 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]     51190: 0x17b9c7f0 android.view.RenderNode
    art/runtime/indirect_reference_table.cc:116]   Summary:
    art/runtime/indirect_reference_table.cc:116]         1 of java.lang.Thread
    art/runtime/indirect_reference_table.cc:116]         3 of byte[] (1188 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:116]         3 of byte[] (4200 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (5984 elements)
    art/runtime/indirect_reference_table.cc:116]         5 of byte[] (7744 elements) (5 unique instances)
    art/runtime/indirect_reference_table.cc:116]         4 of byte[] (8580 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (14520 elements)
    art/runtime/indirect_reference_table.cc:116]         9 of byte[] (17424 elements) (9 unique instances)
    art/runtime/indirect_reference_table.cc:116]         5 of byte[] (21780 elements) (5 unique instances)
    art/runtime/indirect_reference_table.cc:116]        27 of byte[] (21904 elements) (27 unique instances)
    art/runtime/indirect_reference_table.cc:116]         2 of byte[] (29524 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:116]         2 of byte[] (29584 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:116]        17 of byte[] (30976 elements) (17 unique instances)
    art/runtime/indirect_reference_table.cc:116]         3 of byte[] (39204 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:116]         2 of byte[] (40128 elements) (2 unique instances)
    art/runtime/indirect_reference_table.cc:116]         3 of byte[] (67056 elements) (3 unique instances)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (67584 elements)
    art/runtime/indirect_reference_table.cc:116]         4 of byte[] (69696 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:116]         4 of byte[] (91080 elements) (4 unique instances)
    art/runtime/indirect_reference_table.cc:116]         5 of byte[] (226576 elements) (5 unique instances)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (571500 elements)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (657140 elements)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (19305000 elements)
    art/runtime/indirect_reference_table.cc:116]         1 of byte[] (25615408 elements)
    art/runtime/indirect_reference_table.cc:116]        25 of java.lang.DexCache (25 unique instances)
    art/runtime/indirect_reference_table.cc:116]         2 of dalvik.system.PathClassLoader (1 unique instances)
    art/runtime/indirect_reference_table.cc:116]     51067 of android.view.RenderNode (51067 unique instances)
    art/runtime/indirect_reference_table.cc:116] 
A/art: art/runtime/runtime.cc:403] Runtime aborting...
    art/runtime/runtime.cc:403] Aborting thread:
    art/runtime/runtime.cc:403] "main" prio=5 tid=1 Runnable
    art/runtime/runtime.cc:403]   | group="" sCount=0 dsCount=0 obj=0x759e6b10 self=0x766752295a00
    art/runtime/runtime.cc:403]   | sysTid=15742 nice=0 cgrp=default sched=0/0 handle=0x766756c45b40
    art/runtime/runtime.cc:403]   | state=R schedstat=( 0 0 0 ) utm=731 stm=40 core=0 HZ=100
    art/runtime/runtime.cc:403]   | stack=0x7fff8438c000-0x7fff8438e000 stackSize=8MB
    art/runtime/runtime.cc:403]   | held mutexes= "abort lock" "JNI weak global reference table lock" "mutator lock"(shared held)
    art/runtime/runtime.cc:403]   native: #00 pc 000000000052c4ee  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+238)
    art/runtime/runtime.cc:403]   native: #01 pc 00000000004fd45c  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+412)
    art/runtime/runtime.cc:403]   native: #02 pc 00000000004ea43b  /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+43)
    art/runtime/runtime.cc:403]   native: #03 pc 00000000004ea1a2  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+274)
    art/runtime/runtime.cc:403]   native: #04 pc 00000000004dd19d  /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+125)
    art/runtime/runtime.cc:403]   native: #05 pc 000000000014bda8  /system/lib64/libart.so (_ZN3art10LogMessageD1Ev+1240)
    art/runtime/runtime.cc:403]   native: #06 pc 00000000002ca370  /system/lib64/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+304)
    art/runtime/runtime.cc:403]   native: #07 pc 000000000037f639  /system/lib64/libart.so (_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE+73)
    art/runtime/runtime.cc:403]   native: #08 pc 00000000003e18ab  /system/lib64/libart.so (_ZN3art3JNI16NewWeakGlobalRefEP7_JNIEnvP8_jobject+795)
    art/runtime/runtime.cc:403]   native: #09 pc 000000000016a698  /system/lib64/libart.so (_ZN3art8CheckJNI6NewRefEPKcP7_JNIEnvP8_jobjectNS_15IndirectRefKindE+936)
    art/runtime/runtime.cc:403]   native: #10 pc 00000000000f1175  /system/lib64/libandroid_runtime.so (???)
    art/runtime/runtime.cc:403]   native: #11 pc 0000000000bdbf54  /system/framework/x86_64/boot-framework.oat (Java_android_view_RenderNode_nCreate__Ljava_lang_String_2+192)
    art/runtime/runtime.cc:403]   at android.view.RenderNode.nCreate(Native method)
    art/runtime/runtime.cc:403]   at android.view.RenderNode.<init>(RenderNode.java:137)
    art/runtime/runtime.cc:403]   at android.view.RenderNode.create(RenderNode.java:161)
    art/runtime/runtime.cc:403]   at android.view.View.<init>(View.java:4005)
    art/runtime/runtime.cc:403]   at android.view.View.<init>(View.java:4119)
    art/runtime/runtime.cc:403]   at android.view.ViewGroup.<init>(ViewGroup.java:578)
    art/runtime/runtime.cc:403]   at android.widget.LinearLayout.<init>(LinearLayout.java:211)
    art/runtime/runtime.cc:403]   at android.widget.LinearLayout.<init>(LinearLayout.java:207)
    art/runtime/runtime.cc:403]   at android.widget.LinearLayout.<init>(LinearLayout.java:203)
    art/runtime/runtime.cc:403]   at java.lang.reflect.Constructor.newInstance0!(Native method)
    art/runtime/runtime.cc:403]   at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.createView(LayoutInflater.java:645)
    art/runtime/runtime.cc:403]   at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
    art/runtime/runtime.cc:403]   - locked <0x0edca84b> (a java.lang.Object[])
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
    art/runtime/runtime.cc:403]   at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
A/art: art/runtime/runtime.cc:403]   at com.example.erp_android.MyListAdapter.getView(MyListAdapter.java:75)
    art/runtime/runtime.cc:403]   at android.widget.AbsListView.obtainView(AbsListView.java:2362)
    art/runtime/runtime.cc:403]   at android.widget.ListView.makeAndAddView(ListView.java:1970)
    art/runtime/runtime.cc:403]   at android.widget.ListView.fillDown(ListView.java:704)
    art/runtime/runtime.cc:403]   at android.widget.ListView.fillGap(ListView.java:668)
    art/runtime/runtime.cc:403]   at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5185)
    art/runtime/runtime.cc:403]   at android.widget.ListView.trackMotionScroll(ListView.java:1889)
    art/runtime/runtime.cc:403]   at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4733)
    art/runtime/runtime.cc:403]   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
    art/runtime/runtime.cc:403]   at android.view.Choreographer.doCallbacks(Choreographer.java:683)
    art/runtime/runtime.cc:403]   at android.view.Choreographer.doFrame(Choreographer.java:616)
    art/runtime/runtime.cc:403]   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
    art/runtime/runtime.cc:403]   at android.os.Handler.handleCallback(Handler.java:751)
    art/runtime/runt

解决方案 »

  1.   

    我的代码:
    public class java_cut_ddcx_result extends AppCompatActivity {
        // 界面上的控件
        private ListView mListView;
        private MyListAdapter mAdapter;
        private LinearLayout mTitleLayout;    // 相关的数据
        private List<ItemBean> dataList = new ArrayList<>();
        private ItemBean bean;
        private List<String> idList = new ArrayList<>();    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.lay_cut_ddcx_result);
            int COLUMN_NUM;
            int ROW_NUM;
            List<Map<String, Object>> list = DBUtil.mList;
            if (list.size() > 0) {
                COLUMN_NUM = 22;
                ROW_NUM = list.size();
                mListView = (ListView) findViewById(R.id.mListView);
                mTitleLayout = (LinearLayout) findViewById(R.id.titleLayout);
                String[] titels = new String[]{"日期", "订单号", "订单序号", "客户PO号", "订单料号", "品名规格", "本厂编号", "订单数量", "币别", "单价", "金额", "已出货数量",
                        "交货日期", "未出货数量", "客户代码", "客户简称", "订单类型", "订单状态", "建立用户", "建立时间", "审核用户", "审核时间"};
                String[] fields = new String[]{"cut_accdt", "cut_saleid", "cud_serial", "cut_cuspo", "cud_itmnbr", "itmnmsp", "cud_model", "cud_ordqty", "cut_cur", "cud_untprc", "cud_money", "cud_shpqty",
                        "cud_demshp", "cud_notshp", "cut_cusid", "cus_shrtnm", "cut_class", "cud_status", "cut_stpusr", "cut_stpdt", "cut_frmusr", "cut_frmdt"};
                for (String str : titels) {
                    View titleView = LayoutInflater.from(this).inflate(R.layout.item_text, null);
                    TextView title = (TextView) titleView.findViewById(R.id.itemTitleTv);
                    title.setText(str);
                    mTitleLayout.addView(titleView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
                }
                // 准备数据
                for (int i = 1; i <= ROW_NUM; i++) {
                    for (int j = 1; j <= COLUMN_NUM; j++) {
                        Log.e("CJT", "MainActivity---------- idList.add==" + i + "-" + j);
                        idList.add(i + "-" + j);
                    }
                }
                int i = 0;
                for (Map<String, Object> tmpMap : list) {
                    for (String str : fields) {
                        bean = new ItemBean();
                        bean.setId(idList.get(i));
                        bean.setPictureName(tmpMap.get(str).toString());
                        //bean.setPictureResId(R.mipmap.ic_launcher);
                        dataList.add(bean);
                        Log.e("CJT", idList.get(i) + "==" + bean.getPictureName());
                        i++;
                    }
                }            Log.e("CJT", "MainActivity----------dataList.size()==" + dataList.size());
                // 设置适配器
                mAdapter = new MyListAdapter(this, dataList, COLUMN_NUM);
                mListView.setAdapter(mAdapter);
            } else {
                Toast.makeText(this, "LIST长度:" + list.size(), Toast.LENGTH_SHORT).show();
            }
        }
    }
      

  2.   

    public class MyListAdapter extends BaseAdapter {    private Context mContext ;
        private List<ItemBean> mDataLists ;
        private int mColumnNum = 0 ;
        private int mRowNum = 0 ;    public MyListAdapter() {
        }    /**
         *  构造函数
         * @param mContext
         * @param mDataLists
         */
        public MyListAdapter(Context mContext, List<ItemBean> mDataLists , int columnNum ) {
            this.mContext = mContext;
            this.mDataLists = mDataLists;
            this.mColumnNum = columnNum ;
        }    /**
         *  构造函数+1
         * @param mContext
         * @param mDataLists
         * @param columnNum
         */
        public MyListAdapter(Context mContext, List<ItemBean> mDataLists , int columnNum , int rowNum) {
            this.mContext = mContext;
            this.mDataLists = mDataLists;
            this.mColumnNum = columnNum ;
            this.mRowNum = rowNum ;
        }    @Override
        public int getCount() {
            return mDataLists.size();
        }    @Override
        public ItemBean getItem(int i) {
            return mDataLists.get(i);
        }    @Override
        public long getItemId(int i) {
            return i;
        }    @Override
        public View getView(int position, View view, ViewGroup parent) {
                view = LayoutInflater.from(mContext).inflate(R.layout.list_row_layout,null);
                LinearLayout row = (LinearLayout) view.findViewById(R.id.listViewRow);  // 行布局
                ViewHolder holder;
                if(row != null) row.removeAllViews(); // 清空行
                for (int i = 0; i < mColumnNum ; i++) {
                    View itemView = LayoutInflater.from(mContext).inflate(R.layout.item,null);
                    holder=new ViewHolder();
                    holder.textView=(TextView) itemView.findViewById(R.id.itemNameTv);
                    //TextView itemNameTv = (TextView) itemView.findViewById(R.id.itemNameTv);
                    ItemBean itemBean = getLocationBean(position+1 , i+1); // 获取对应的实体类
                    if(itemBean != null){
                        //itemNameTv.setText(itemBean.getPictureName());
                        holder.textView.setText(itemBean.getPictureName());
                        row.addView(itemView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
                    }
                }
                if((position+1)%2==0){
                    view.setBackgroundResource(R.color.LightCyan1);
                }
            return view;  // 返回加载好了内容的行布局
        }    /***
         *  根据座位号获取对应的元素
         * @param row
         * @param column
         * @return
         */
        private ItemBean getLocationBean(int row , int column){
            String index =row +"-"+column; // 生成索引,对比索引找到对应的学生
            for (int i = 0; i < this.getCount(); i++) {
                if(this.getItem(i).getId().equals(index))
                    return this.getItem(i) ;
            }
            return null ;
        }
        public class ViewHolder {
            public TextView textView;
        }
    }
      

  3.   

    public class ItemBean {    private String id ; // 形如2-3 以坐标的形式来表示
        private int pictureResId ;
        private String pictureName ;    public String getId() {
            return id;
        }    public void setId(String id) {
            this.id = id;
        }    public int getPictureResId() {
            return pictureResId;
        }    public void setPictureResId(int pictureResId) {
            this.pictureResId = pictureResId;
        }    public String getPictureName() {
            return pictureName;
        }    public void setPictureName(String pictureName) {
            this.pictureName = pictureName;
        }    @Override
        public String toString() {
            return "ItemBean{" +
                    "id='" + id + '\'' +
                    ", pictureResId=" + pictureResId +
                    ", pictureName='" + pictureName + '\'' +
                    '}';
        }
    }
      

  4.   

    at com.example.erp_android.MyListAdapter.getView(MyListAdapter.java:75)这里报错了。
    建议使用recyclerview,ListView在加载性能和动画上都不如recyclerview,重点是recyclerview可以一行代码更换显示模式。
      

  5.   

    从你复制出来的Logcat里看,他说你在主线程里的做的工作太多了,它嫌弃你了,所以罢工了,你最好哄哄它