适用于Android的OData4j:XmlInputFactory的ClassNotFoundException [英] OData4j for Android: ClassNotFoundException for XmlInputFactory

查看:71
本文介绍了适用于Android的OData4j:XmlInputFactory的ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次尝试学习Java,因此我想将Windows Phone应用程序移植到Android上开始学习.我正在尝试使用OData4j 0.7 jar库调用我现有的WCF数据服务(可在WP应用程序/浏览器中使用),但是出现以下错误:

This is the first time I'm attempting to learn Java so I thought i'd port my Windows Phone application over to Android to begin learning. I'm trying to use the OData4j 0.7 jar library to call my existing WCF Data Service (which works in my WP app / browser), but I'm getting the following error:

Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.stream.XMLInputFactory" on path: DexPathList[[zip file "/data/app/myfirstapp.blazemonkey.com.myfirstapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/
07-26 13:02:41.452    3736-3736/myfirstapp.blazemonkey.com.myfirstapp E/ProviderFactory﹕ The provider class, class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.TypeNotPresentException: Type javax.xml.stream.XMLInputFactory not present
...

每次我运行此代码:

ODataConsumer consumer = ODataJerseyConsumer.create(serviceUrl);

我已经拉了很长时间,所以希望有人能指出我正确的方向!我已经添加了用户权限标签:

I've been pulling my hair out for a long time so hopefully someone can point me to the right direction! I have already added the users-permission tag:

<uses-permission android:name="android.permission.INTERNET"/>

所以那也不应该是问题.

so that shouldn't be the problem either.

非常感谢!

推荐答案

javax.xml.stream软件包不是Android的一部分.您无法在Android应用中使用它或任何其他需要它的库.这就是为什么您会出错.

javax.xml.stream package is not a part of Android. You cannot use it or any other library requiring it in your Android app. That's why you're getting error.

根据OData4j的描述,它也可以与StAX解析器一起使用,这在Android中是存在的.您应该看看他们的 Android官方示例,以了解该库如何与Android中的StAX解析器一起使用.希望这会有所帮助.

According to OData4j description, it can work with StAX parser too, which is present in Android. You should have a look into their official Android example to find out how this library should be used with StAX parser in Android. Hope this helps.

这篇关于适用于Android的OData4j:XmlInputFactory的ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆