我正在开发一个Android应用程序,它有一个包含两种不同视图类型的列表视图
该应用程序在4.1+ Android设备上运行良好。但它在4.0.x设备上崩溃。
只有在以下网络中展示广告时才会发生崩溃:
我正在使用chris banes pull刷新(你可以找到它):
我尝试了很多其他adnetworks,但它正在运行。有什么想法吗?
java.lang.StackOverflowError
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4312)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:4316)
at android.view.View.getGlobalVisibleRect(View.java:8126)
at android.webkit.WebView.calcOurVisibleRect(WebView.java:2952)
at android.webkit.WebView.calcOurContentVisibleRectF(WebView.java:2975)
at android.webkit.WebView.drawCoreAndCursorRing(WebView.java:4655)
at android.webkit.WebView.drawContent(WebView.java:4215)
at android.webkit.WebView.onDraw(WebView.java:4298)
at android.view.View.draw(View.java:11082)
at com.adsdk.sdk.banner.BannerAdView$1.draw(BannerAdView.java:185)
at android.view.View.buildDrawingCache(View.java:10799)
at android.view.ViewGroup.drawChild(ViewGroup.java:2845)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.widget.FrameLayout.draw(FrameLayout.java:462)
at android.gesture.GestureOverlayView.draw(GestureOverlayView.java:393)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.widget.ListView.drawChild(ListView.java:3219)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2099)
at android.widget.ListView.dispatchDraw(ListView.java:3214)
at com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListView.d
ispatchDraw(PullToRefreshListView.java:293)
at android.view.View.draw(View.java:11085)
at android.widget.AbsListView.draw(AbsListView.java:3419)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.support.v4.view.ViewPager.draw(ViewPager.java:2094)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.widget.FrameLayout.draw(FrameLayout.java:462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:2989)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at net.simonvt.menudrawer.BuildLayerFrameLayout.dispatchDraw(BuildLayerFrameLayout.java:77)
at android.view.View.draw(View.java:11085)
at android.widget.FrameLayout.draw(FrameLayout.java:462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at net.simonvt.menudrawer.MenuDrawer.dispatchDraw(MenuDrawer.java:667)
at android.view.View.draw(View.java:11085)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at net.simonvt.menudrawer.BuildLayerFrameLayout.dispatchDraw(BuildLayerFrameLayout.java:77)
at android.view.View.draw(View.java:11085)
at android.widget.FrameLayout.draw(FrameLayout.java:462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at net.simonvt.menudrawer.MenuDrawer.dispatchDraw(MenuDrawer.java:667)
at android.view.View.draw(View.java:11085)
at android.view.ViewGroup.drawChild(ViewGroup.java:2991)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2593)
at android.view.View.draw(View.java:11085)
at android.widget.FrameLayout.draw(FrameLayout.java:462)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2145)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2026)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4441)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
我强烈建议您将AdView移到ListView之外,并在其上方或下方自行显示。 ListView不易于显示不同类型的对象,因此导致许多问题,就像您所描述的那样。
通过将其移出ListView,您的ListView代码将从根本上简化。
答案 1 :(得分:0)
我发现广告视图尝试从这些来源加载广告时出现问题。它发生在Listview中的getChildVisibleRect()方法中 我解决了这个问题,通过黑客攻击这个方法强制它返回false,返回空的可见矩形,对于低于软糖的android版本。
我已经测试了它,它对我来说很好。我希望它有所帮助。
答案 2 :(得分:0)
我在Manifest
文件中进行了以下更改,并且有效:
android:largeHeap="true"
在<application>
标记