我下载并测试了HTC opensense SDK。但我无法测试任何示例应用程序。布局中的main.xml文件显示如下
找不到以下课程:
- com.htc.painting.engine.HTCPaintingView(修复构建路径,编辑XML, 创建类)
- com.htc.painting.penmenu.PenMenu(修复构建路径,编辑XML,创建 类)
我该如何解决这个问题?
我看到像这样的日志猫错误
10-04 12:02:05.001: ERROR/dalvikvm(580): Could not find class 'com.htc.painting.penmenu.PenMenu', referenced from method com.htc.demo.penmenu.MainActivity.init
10-04 12:02:05.510: ERROR/AndroidRuntime(580): FATAL EXCEPTION: main
10-04 12:02:05.510: ERROR/AndroidRuntime(580): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.htc.demo.penmenu/com.htc.demo.penmenu.MainActivity}: android.view.InflateException: Binary XML file line #55: Error inflating class com.htc.painting.engine.HtcPaintingView
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.os.Handler.dispatchMessage(Handler.java:99)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.os.Looper.loop(Looper.java:132)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread.main(ActivityThread.java:4025)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at java.lang.reflect.Method.invokeNative(Native Method)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at java.lang.reflect.Method.invoke(Method.java:491)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at dalvik.system.NativeStart.main(Native Method)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): Caused by: android.view.InflateException: Binary XML file line #55: Error inflating class com.htc.painting.engine.HtcPaintingView
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:223)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.Activity.setContentView(Activity.java:1780)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at com.htc.demo.penmenu.MainActivity.onCreate(MainActivity.java:42)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): ... 11 more
10-04 12:02:05.510: ERROR/AndroidRuntime(580): Caused by: java.lang.ClassNotFoundException: com.htc.painting.engine.HtcPaintingView in loader dalvik.system.PathClassLoader[/data/app/com.htc.demo.penmenu-1.apk]
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.createView(LayoutInflater.java:542)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
10-04 12:02:05.510: ERROR/AndroidRuntime(580): ... 21 more
答案 0 :(得分:1)
我和HTC的一个人说话,在样本中只有一个例子正在运行,几周后会有更新,其他功能将得到支持
答案 1 :(得分:0)
这个问题是main.xml引用了自定义View,在这种情况下是在HTCExtension.jar存档中,所以你必须在构建路径上有HTCExtension.jar。
但是我打开示例项目时没有任何问题,所有内容都已正确设置并且可以构建。 尝试重新安装整个SDK并再次打开示例。