3

我已经看到我的应用程序发生了几次崩溃,我无法确定发生了什么问题。即使有我的用户在崩溃时正在做什么的视频,我也没有任何运气重现。这似乎不是“每次”崩溃。

有人可以从下面的堆栈跟踪中告诉我我的问题是什么吗?似乎膨胀方法直接失败了。如果这是一个“系统”问题(典型的开发人员......责怪本机,我知道:P),有什么建议来处理它吗?我以前从未见过任何人捕捉和处理通货膨胀异常。

堆栈跟踪如下:

android.view.InflateException
android.view.LayoutInflater.createView(LayoutInflater.java:619)
android.view.LayoutInflater.onCreateView(LayoutInflater.java:649)
android.view.LayoutInflater.onCreateView(LayoutInflater.java:666)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
android.view.LayoutInflater.inflate(LayoutInflater.java:467)
android.view.LayoutInflater.inflate(LayoutInflater.java:397)
com.weddingwire.vendorsearch.adapters.GalleryImageAdapter.getView(GalleryImageAdapter.java:40)
it.sephiroth.android.library.widget.AbsHListView.a(AbsHListView.java:1950)
it.sephiroth.android.library.widget.HListView.a(HListView.java:1887)
it.sephiroth.android.library.widget.HListView.g(HListView.java:692)
it.sephiroth.android.library.widget.HListView.g(HListView.java:754)
it.sephiroth.android.library.widget.HListView.e(HListView.java:1706)
it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1791)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.widget.ScrollView.onLayout(ScrollView.java:1725)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2019)
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1840)
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1133)
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4632)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
android.view.Choreographer.doCallbacks(Choreographer.java:555)
android.view.Choreographer.doFrame(Choreographer.java:525)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
android.os.Handler.handleCallback(Handler.java:615)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4938)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.reflect.Constructor.constructNative(Native Method)
java.lang.reflect.Constructor.newInstance(Constructor.java:417)
android.view.LayoutInflater.createView(LayoutInflater.java:593)
android.view.LayoutInflater.onCreateView(LayoutInflater.java:649)
android.view.LayoutInflater.onCreateView(LayoutInflater.java:666)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
android.view.LayoutInflater.inflate(LayoutInflater.java:467)
android.view.LayoutInflater.inflate(LayoutInflater.java:397)
com.company.app.adapters.GalleryImageAdapter.getView(GalleryImageAdapter.java:40)
it.sephiroth.android.library.widget.AbsHListView.a(AbsHListView.java:1950)
it.sephiroth.android.library.widget.HListView.a(HListView.java:1887)
it.sephiroth.android.library.widget.HListView.g(HListView.java:692)
it.sephiroth.android.library.widget.HListView.g(HListView.java:754)
it.sephiroth.android.library.widget.HListView.e(HListView.java:1706)
it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1791)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.widget.ScrollView.onLayout(ScrollView.java:1725)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.widget.FrameLayout.onLayout(FrameLayout.java:448)
android.view.View.layout(View.java:14101)
android.view.ViewGroup.layout(ViewGroup.java:4655)
android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2019)
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1840)
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1133)
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4632)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
android.view.Choreographer.doCallbacks(Choreographer.java:555)
android.view.Choreographer.doFrame(Choreographer.java:525)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
android.os.Handler.handleCallback(Handler.java:615)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4938)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
dalvik.system.NativeStart.main(Native Method)

相关代码来自我认为非常典型的 ArrayAdapter。getView 方法(包含来自 GalleryImageAdapter 的问题堆栈跟踪行)如下:

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ButterKnifeViewHolder holder;
    View v = convertView;

    if (v != null) {
        holder = (ButterKnifeViewHolder) v.getTag(R.id.key_view_holder);
    } else {
        v = inflater.inflate(R.layout.view_gallery_image, parent, false);
        holder = new ButterKnifeViewHolder(v);
        if (v != null) {
            v.setTag(R.id.key_view_holder, holder);
        }
    }

    if (holder != null) {
        WWUiUtility.loadImage(getContext(),
                getItem(position).getImage_400x400Url(),
                holder.mImage);
    }

    return v;
}

我的 ViewHolder 如下:

static class ButterKnifeViewHolder {
    @InjectView(R.id.gallery_image)
    ImageView mImage;

    ButterKnifeViewHolder(View view) {
        ButterKnife.inject(this, view);
    }
}
4

0 回答 0