Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

保持默认设置,网络环境切换后打开应用FC #207

Closed
izzyleung opened this issue Jan 3, 2014 · 10 comments
Closed

保持默认设置,网络环境切换后打开应用FC #207

izzyleung opened this issue Jan 3, 2014 · 10 comments

Comments

@izzyleung
Copy link

四次元基于最新版本 Gradle 构建。在从 3G 环境转换至家中的 Wi-Fi 环境后,打开四次元永远 FC。但是切换至 3G 环境,软件可以正常打开。

机型:Meizu MX II(Genymotion 不支持 3G 模拟,所以无法用它重现问题,很抱歉)

StackTrace 如下:

java.lang.NullPointerException
at org.qii.weiciyuan.ui.adapter.AbstractAppListAdapter.buildHolder(AbstractAppListAdapter.java:397)
at org.qii.weiciyuan.ui.adapter.AbstractAppListAdapter.getView(AbstractAppListAdapter.java:312)
at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
at android.widget.AbsListView.obtainView(AbsListView.java:2314)
at android.widget.ListView.makeAndAddView(ListView.java:1969)
at android.widget.ListView.fillSpecific(ListView.java:1400)
at android.widget.ListView.layoutChildren(ListView.java:1738)
at org.qii.weiciyuan.support.lib.AutoScrollListView.layoutChildren(AutoScrollListView.java:51)
at android.widget.AbsListView.onLayout(AbsListView.java:2096)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at com.slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:477)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:985)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14150)
at android.view.ViewGroup.layout(ViewGroup.java:4402)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1946)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1765)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:999)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4470)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5068)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

@qii
Copy link
Owner

qii commented Jan 3, 2014

我被这崩溃弄烦死了,我让一个懂代码的用户帮忙调试了,发现问题很奇怪,我这边没设备可以重现

那个用户是因为切换主题才崩溃,崩溃的地方也是这里

原因是 AbstractAppListAdapter ListView 有3种类型的 item 视图:【小图】,【大图】和【载入中间】

getView 的时候,switch 语句生成View,原本应该是【小图】或【大图】,结果却生成了【载入中间】视图,接着就是找不到对应的控件,空指针了

之所以难办在于,如果是逻辑错误,那么我这边肯定能重现,但是根据用户帮忙调试来看,去读取的 xml 是正确的,但是出来的 View 却是错的

你要是能帮忙那是最好了

@qii
Copy link
Owner

qii commented Jan 3, 2014

后台记录的因为这个问题引起的崩溃都快破800了 T.T

@izzyleung
Copy link
Author

唔,略懂一点安卓,我尝试着帮忙看看。

而且,刚刚很奇怪的是,用Wi-Fi环境没有FC就直接进去了… 囧rz

@izzyleung
Copy link
Author

不知道是不是由于这个帖子里面提到的原因,一个 == null 的判断

https://groups.google.com/forum/#!topic/android-developers/9rwYvsfG_fg

@qii
Copy link
Owner

qii commented Jan 3, 2014

不一样啊,我这边是读取了R.layout.timeline_listview_item_layout,生成了R.layout.timeline_listview_item_middle_layout

@qii
Copy link
Owner

qii commented Jan 3, 2014

你会发现,进了294行,生成的应该是个RelativeLayout,结果出来的是FrameLayout

@feicien
Copy link

feicien commented Jan 3, 2014

我在使用FrameLayout布局时出现过这样的问题:调用findViewbyId得不到该id的控件,得到的是FrameLayout的第一个子控件,然后就报classCastExeception

你会发现,进了294行,生成的应该是个RelativeLayout,结果出来的是FrameLayout


Reply to this email directly or view it on
GitHubhttps://github.com//issues/207#issuecomment-31510507
.

@qii
Copy link
Owner

qii commented Jan 3, 2014

@izzyleung 你说的是对的

我优化来优化去,结果出了逻辑漏洞

@qii
Copy link
Owner

qii commented Jan 3, 2014

f457b45

已经修正

这bug隐藏太深,我一年都没发现,我这边从没因为这个崩溃过

@qii qii closed this as completed Jan 3, 2014
@izzyleung
Copy link
Author

@qii Great!

唔,对了,新版更新之后,org.qii.weiciyuan.support.utils.GlobalContext 里面增加了 Crashlytics 的内容,最好在 README 里面更新一下,告诉大家把他们注释掉吧~ ;-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants