升级到支持库25.0.0后,在Android 2.3.3上崩溃(java.lang.NoSuchMethodError:android.view.View.isAttachedToWindow)

时间:2016-11-01 13:42:37

标签: java android android-appcompat

升级到最新版本的支持库后,我无法再在Android 2.3.3上运行该应用程序。应用程序在启动期间使用

崩溃
  

11-01 13:53:16.580 2115-2115 / no.bouvet.routeplanner.atb E / AndroidRuntime:FATAL EXCEPTION:main                                                                             java.lang.NoSuchMethodError:android.view.View.isAttachedToWindow                                                                                 在android.support.v7.widget.ForwardingListener $ 2.(ForwardingListener.java:102)                                                                                 在android.support.v7.widget.ForwardingListener.addDetachListenerBase(ForwardingListener.java:101)                                                                                 在android.support.v7.widget.ForwardingListener。(ForwardingListener.java:78)                                                                                 在android.support.v7.widget.ActionMenuPresenter $ OverflowMenuButton $ 1.(ActionMenuPresenter.java:650)                                                                                 在android.support.v7.widget.ActionMenuPresenter $ OverflowMenuButton。(ActionMenuPresenter.java:650)                                                                                 在android.support.v7.widget.ActionMenuPresenter.initForMenu(ActionMenuPresenter.java:114)                                                                                 在android.support.v7.view.menu.MenuBuilder.addMenuPresenter(MenuBuilder.java:262)                                                                                 在android.support.v7.widget.ActionMenuView.getMenu(ActionMenuView.java:656)                                                                                 在android.support.v7.widget.Toolbar.ensureMenu(Toolbar.java:1037)                                                                                 在android.support.v7.widget.Toolbar.getMenu(Toolbar.java:1008)                                                                                 在android.support.v7.widget.ToolbarWidgetWrapper.getMenu(ToolbarWidgetWrapper.java:676)                                                                                 在android.support.v7.app.ToolbarActionBar.getMenu(ToolbarActionBar.java:595)                                                                                 在android.support.v7.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:447)                                                                                 在android.support.v7.app.ToolbarActionBar $ 1.run(ToolbarActionBar.java:61)                                                                                 在android.os.Handler.handleCallback(Handler.java:587)                                                                                 在android.os.Handler.dispatchMessage(Handler.java:92)                                                                                 在android.os.Looper.loop(Looper.java:130)                                                                                 在android.app.ActivityThread.main(ActivityThread.java:3683)                                                                                 at java.lang.reflect.Method.invokeNative(Native Method)                                                                                 在java.lang.reflect.Method.invoke(Method.java:507)                                                                                 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:839)                                                                                 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)                                                                                 在dalvik.system.NativeStart.main(本地方法)

使用的依赖项是:

compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:support-compat:25.0.0'
compile 'com.android.support:support-core-ui:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:preference-v7:24.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:recyclerview-v7:24.2.1'

我降级到24.2.2时错误消失,但这会导致其他问题(使用默认的android搜索视图时,用户输入的文本不可见,即使自动完成工作正常)

我认为这是支持库中的一个错误。有没有人看到同样的问题,知道修复?

2 个答案:

答案 0 :(得分:3)

支持库25.0.0存在问题:https://code.google.com/p/android/issues/detail?id=225647。 您可以通过在Android Studio中创建新项目并使用标准Basic Activity模板来重现该问题。该应用将在设备API 11及更低版本的setSupportActionBar(toolbar);上崩溃。 除了降级支持库版本之外,我没有找到其他解决方案。

答案 1 :(得分:1)

新问题解决了这个问题: Android支持库,修订版25。05。1(2016年11月) https://developer.android.com/topic/libraries/support-library/revisions.html