我正在为Wear应用程序编写自定义布局。我的其他CardLayout卡工作正常。然而,我正在编写的片段使用WearableListView并遵循http://developer.android.com/training/wearables/ui/lists.html#
上的示例部署到手表上的My Wear应用程序确实包含来自wearable 1.1.0的libs目录下的classes.jar。
我在物理LG G手表和圆形手表模拟器上失败了。我没有尝试过任何其他地方。
我得到的例外情况如下。
感谢您的帮助, 吉姆
01-23 18:09:41.721: W/ActivityThread(14531): Application com.mycompany.my_application is waiting for the debugger on port 8100...
01-23 18:09:41.737: I/System.out(14531): Sending WAIT chunk
01-23 18:09:41.761: I/art(14531): Debugger is active
01-23 18:09:41.941: I/System.out(14531): Debugger has connected
01-23 18:09:41.941: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:42.141: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:42.341: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:42.542: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:42.742: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:42.942: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:43.144: I/System.out(14531): waiting for debugger to settle...
01-23 18:09:43.344: I/System.out(14531): debugger has settled (1453)
01-23 18:09:43.392: D/MyApplication_WEAR(14531): MyApplicationWearableMainActivity.MyApplicationWearableLibraryMainActivity()
01-23 18:09:43.859: D/OpenGLRenderer(14531): Render dirty regions requested: true
01-23 18:09:43.878: D/Atlas(14531): Validating map...
01-23 18:09:43.972: D/WearableClient(14531): WearableClientImpl.onPostInitHandler: done
01-23 18:09:44.150: D/MyApplication_WEAR(14531): setOnLayoutInflatedListener:setOnLayoutInflatedListener()
01-23 18:09:44.199: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView$ViewHolder>
01-23 18:09:44.199: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView$ViewHolder>
01-23 18:09:44.221: I/art(14531): Background sticky concurrent mark sweep GC freed 3677(253KB) AllocSpace objects, 1(12KB) LOS objects, 5% free, 4MB/5MB, paused 7.613ms total 91.511ms
01-23 18:09:45.211: W/art(14531): Verification of void com.mycompany.my_application.SampleGridPagerAdapter$RecordFragment.onClick(android.support.wearable.view.WearableListView$ViewHolder) took 1.022s
01-23 18:09:45.214: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView>
01-23 18:09:45.214: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView>
01-23 18:09:45.232: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView$Adapter>
01-23 18:09:45.232: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView$Adapter>
01-23 18:09:45.241: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<com.mycompany.my_application.RecordFragmentAdapter>
01-23 18:09:45.241: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<com.mycompany.my_application.RecordFragmentAdapter>
01-23 18:09:45.407: I/art(14531): Background partial concurrent mark sweep GC freed 887(115KB) AllocSpace objects, 0(0B) LOS objects, 25% free, 5MB/6MB, paused 10.177ms total 71.461ms
01-23 18:09:45.465: W/Adreno-GSL(14531): <ioctl_kgsl_device_getproperty:675>: mmap failed: errno 22 Invalid argument
01-23 18:09:45.465: I/Adreno-EGL(14531): <eglInitialize:410>: EGL 1.4 QUALCOMM Build: If7fdd9c3afa1d9fdf099b4915d6d8c4a2a4ddc87Date: 11/20/14
01-23 18:09:45.466: I/OpenGLRenderer(14531): Initialized EGL, version 1.4
01-23 18:09:45.494: D/OpenGLRenderer(14531): Enabling debug mode 0
01-23 18:09:45.528: D/Loader(14531): Loading asset 0x7f020057
01-23 18:09:45.572: D/MyApplication_WEAR(14531): MyApplicationWearableMainActivity.onConnected()
01-23 18:09:45.572: I/Choreographer(14531): Skipped 94 frames! The application may be doing too much work on its main thread.
01-23 18:09:46.173: D/ViewRootImpl(14531): changeCanvasOpacity: opaque=true
01-23 18:10:07.112: W/View(14531): requestLayout() improperly called by android.widget.TextView{248546b9 V.ED..C. ......ID 12,123-222,222 #7f050058 app:id/alignmentText} during layout: running second layout pass
01-23 18:10:07.951: W/View(14531): requestLayout() improperly called by android.widget.TextView{248546b9 V.ED..C. ........ 12,123-222,222 #7f050058 app:id/alignmentText} during second layout pass: posting in next frame
01-23 18:10:08.361: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView>
01-23 18:10:08.362: I/art(14531): Rejecting re-init on previously-failed class java.lang.Class<android.support.wearable.view.WearableListView>
01-23 18:10:11.229: D/AndroidRuntime(14531): Shutting down VM
01-23 18:10:11.254: E/AndroidRuntime(14531): FATAL EXCEPTION: main
01-23 18:10:11.254: E/AndroidRuntime(14531): Process: com.mycompany.my_application, PID: 14531
01-23 18:10:11.254: E/AndroidRuntime(14531): android.view.InflateException: Binary XML file line #13: Error inflating class android.support.wearable.view.WearableListView
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
01-23 18:10:11.254: E/AndroidRuntime(14531): at com.mycompany.my_application.SampleGridPagerAdapter$AbstractMy_ApplicationFragment.onCreateView(SampleGridPagerAdapter.java:224)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.Fragment.performCreateView(Fragment.java:2053)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.BackStackRecord.run(BackStackRecord.java:833)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:483)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.support.wearable.view.FragmentGridPagerAdapter.finishUpdate(FragmentGridPagerAdapter.java:196)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.support.wearable.view.GridViewPager.populate(GridViewPager.java:1161)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.support.wearable.view.GridViewPager.populate(GridViewPager.java:1008)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.support.wearable.view.GridViewPager.access$100(GridViewPager.java:41)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.support.wearable.view.GridViewPager$1.run(GridViewPager.java:90)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.Choreographer.doFrame(Choreographer.java:549)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.os.Handler.handleCallback(Handler.java:739)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.os.Handler.dispatchMessage(Handler.java:95)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.os.Looper.loop(Looper.java:135)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.app.ActivityThread.main(ActivityThread.java:5221)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.reflect.Method.invoke(Native Method)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.reflect.Method.invoke(Method.java:372)
01-23 18:10:11.254: E/AndroidRuntime(14531): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
01-23 18:10:11.254: E/AndroidRuntime(14531): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
01-23 18:10:11.254: E/AndroidRuntime(14531): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.wearable.view.WearableListView" on path: DexPathList[[zip file "/data/app/com.mycompany.my_application-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.createView(LayoutInflater.java:571)
01-23 18:10:11.254: E/AndroidRuntime(14531): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
01-23 18:10:11.254: E/AndroidRuntime(14531): ... 28 more
01-23 18:10:11.254: E/AndroidRuntime(14531): Suppressed: java.lang.NoClassDefFoundError: android.support.wearable.view.WearableListView
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.DexFile.defineClassNative(Native Method)
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.DexFile.defineClass(DexFile.java:226)
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.DexPathList.findClass(DexPathList.java:321)
01-23 18:10:11.254: E/AndroidRuntime(14531): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
01-23 18:10:11.254: E/AndroidRuntime(14531): ... 32 more
01-23 18:10:11.254: E/AndroidRuntime(14531): Suppressed: java.lang.ClassNotFoundException: android.support.wearable.view.WearableListView
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.Class.classForName(Native Method)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
01-23 18:10:11.254: E/AndroidRuntime(14531): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
01-23 18:10:11.254: E/AndroidRuntime(14531): ... 31 more
01-23 18:10:11.254: E/AndroidRuntime(14531): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
01-23 18:10:16.690: I/Process(14531): Sending signal. PID: 14531 SIG: 9
答案 0 :(得分:0)
如果您使用gradle构建项目,或者如果使用gradle,则检查项目中是否具有所有可穿戴库依赖项(它依赖于support-v4和support-v13库),或者您具有正确的传递依赖项。