启动布局检查器时"Error obtaining view hierarchy: Unexpected error: empty view hierarchy"



我在启动布局Inspector时会收到错误消息:"错误获取视图层次结构:意外错误:空视图层次结构"。

也有一个例外:

12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater I/art: Exception thrown by dispatcher for 0x56555254
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: java.lang.NoClassDefFoundError: android.graphics.drawable.Icon
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.Class.getDexCacheType(Class.java:479)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:236)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.reflect.ArtMethod.getParameterTypes(ArtMethod.java:176)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.reflect.Method.getParameterTypes(Method.java:174)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.Class.getDeclaredMethods(Class.java:802)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:1118)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.exportMethods(ViewDebug.java:1209)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:1155)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:1141)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpView(ViewDebug.java:1058)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:997)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.view.ViewDebug.dump(ViewDebug.java:855)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.ddm.DdmHandleViewDebug.dumpHierarchy(DdmHandleViewDebug.java:235)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at android.ddm.DdmHandleViewDebug.handleChunk(DdmHandleViewDebug.java:134)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java:171)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.graphics.drawable.Icon" on path: DexPathList[[zip file "/data/app/com.tst.nikita.yandextranslater-2/base.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.tst.nikita.yandextranslater-2/lib/arm, /vendor/lib, /system/lib]]
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:    ... 24 more
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:    Suppressed: java.lang.ClassNotFoundException: android.graphics.drawable.Icon
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.Class.classForName(Native Method)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err:        ... 26 more
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err:    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

我使用Android Studio 3.0.1。

设备-Android 5.0.1。

来自清单文件:

compileSdkVersion 26
buildToolsVersion '26.0.3'
minSdkVersion 21
targetSdkVersion 26

我注意到使用蓝牙时也可能发生这种情况。当我关闭蓝牙以使我的代码停止扫描时,我可以捕获视图层次结构。

相关内容

  • 没有找到相关文章

最新更新