You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stetho needs android.support.v4.view.accessibility.AccessibilityNodeInfoCompat. However, it does not depend upon support-compat, the Android SDK artifact that (now) houses that class. As a result, if the project does not already have that dependency, Stetho crashes.
The attached project can be used to reproduce the problem. At the moment, support-compat is commented out in app/build.gradle. If you run the project, and you start navigating the view hierarchy using the Elements view, after a few layers, you eventually crash with:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;
at com.facebook.stetho.inspector.elements.android.ViewDescriptor.onGetAccessibilityStyles(ViewDescriptor.java:189)
at com.facebook.stetho.inspector.elements.android.ViewDescriptor.onGetAccessibilityStyles(ViewDescriptor.java:40)
at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getAccessibilityStyles(AbstractChainedDescriptor.java:163)
at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getAccessibilityStyles(AbstractChainedDescriptor.java:162)
at com.facebook.stetho.inspector.elements.Document.getElementAccessibilityStyles(Document.java:153)
at com.facebook.stetho.inspector.protocol.module.CSS$2.run(CSS.java:150)
at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:90)
at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:87)
at com.facebook.stetho.common.android.HandlerUtil$WaitableRunnable.run(HandlerUtil.java:109)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.view.accessibility.AccessibilityNodeInfoCompat" on path: DexPathList[[zip file "/data/app/com.commonsware.android.stetho-1/base.apk"],nativeLibraryDirectories=[/data/app/com.commonsware.android.stetho-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.facebook.stetho.inspector.elements.android.ViewDescriptor.onGetAccessibilityStyles(ViewDescriptor.java:189)
at com.facebook.stetho.inspector.elements.android.ViewDescriptor.onGetAccessibilityStyles(ViewDescriptor.java:40)
at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getAccessibilityStyles(AbstractChainedDescriptor.java:163)
at com.facebook.stetho.inspector.elements.AbstractChainedDescriptor.getAccessibilityStyles(AbstractChainedDescriptor.java:162)
at com.facebook.stetho.inspector.elements.Document.getElementAccessibilityStyles(Document.java:153)
at com.facebook.stetho.inspector.protocol.module.CSS$2.run(CSS.java:150)
at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:90)
at com.facebook.stetho.common.android.HandlerUtil$2.onRun(HandlerUtil.java:87)
at com.facebook.stetho.common.android.HandlerUtil$WaitableRunnable.run(HandlerUtil.java:109)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: android.support.v4.view.accessibility.AccessibilityNodeInfoCompat
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
If you uncomment the debugCompile 'com.android.support:support-compat:25.2.0' statement in Gradle, Stetho runs without issue.
Let me know if you need additional information — thanks!
Hmm I think this was actually a mistake in the accessibility diffs. We should not have a hard dependency on the compat library for accessibility but rather should be using the compat lib only if it's present and also using the framework version directly if it's available (we're running on the right platform version)
Looking at this closer, this was definitely a mistake. We're using support lib and compat library code without checking whether it's in the classpath which means that we now have an undeclared hard dependency on two libraries we explicitly didn't want to hard dep. I'm somewhat surprised we're not seeing more users complaining about this actually...
#511 should resolve this issue. If you don't include the support library in your application it will simply disable the accessibility inspection feature.
Stetho needs
android.support.v4.view.accessibility.AccessibilityNodeInfoCompat
. However, it does not depend uponsupport-compat
, the Android SDK artifact that (now) houses that class. As a result, if the project does not already have that dependency, Stetho crashes.The attached project can be used to reproduce the problem. At the moment,
support-compat
is commented out inapp/build.gradle
. If you run the project, and you start navigating the view hierarchy using the Elements view, after a few layers, you eventually crash with:If you uncomment the
debugCompile 'com.android.support:support-compat:25.2.0'
statement in Gradle, Stetho runs without issue.Let me know if you need additional information — thanks!
Stetho.zip
The text was updated successfully, but these errors were encountered: