2010-08-10 56 views
1

我的Android应用程序在Eclipse下运行正常,然后尝试从一些在线示例中添加一些GridView示例代码,现在它不会再生成/运行。我不断收到主要错误:我的Android应用程序出现“故障处理”错误

故障处理“的javax /网/ SocketFactory.class”: [2010-08-10十七时35分12秒 - 中寿] 尝试包括比其他一些核心VM类一个核心图书馆。

我从来没有在我的任何代码中使用'SocketFactory'。我搜索了我的所有代码,并找不到包含SocketFactory.class的任何代码。

我删除了我正在处理的xml和类,这些都与GridView有关,并且恢复为之前运行的代码 - 但现在我继续得到上述错误。我甚至尝试使用'清洁',但错误仍在继续。

有谁知道我该怎么处理这个错误?

回答

2

尝试rightclicking您的项目,Android的工具 - >修复项目属性

+0

谢谢试图帮助先生。我用'修复项目',但它似乎并没有工作。我稍后将对此进行更多的尝试。我最终做的是将所有项目都复制到一个新项目中,使用相同的代码,并且它的工作和构建毫无问题。 – Allan 2010-08-15 09:13:21

+0

我有类似的问题,通常复制到一个新的项目会伎俩,但它可能是痛苦的,如果它是一个大型项目,你在源代码控制等通常有一个解决方案,通常完全不明显,可能有关到构建路径。你可以尝试删除库,清理,然后将它们添加回... – MalcomTucker 2010-08-16 11:39:44

+1

我有几乎相同的问题,只是有一天打开Eclipse,发现这个错误。仅供参考 - 在android.jar库中,似乎是“javax/net/SocketFactory.class”*是蚂蚁正在掠过的! – Kingsolmn 2011-04-28 08:03:52

2

如果您是在与其他第三方库一个较大的项目工作,我发现它更好用的android.jar从Maven仓库...

原因是,android.jar附带一堆其他库,例如junit 3. 所以,如果你想使用junit 4测试,你必须担心两个.jar在哪里在类路径中,因此junit 3不会影响你的junit 4 jar。

另请注意,某些第三方库使用Android不喜欢的包结构。 例如stax-api-1.0.1.jar。它就像一个封装结构:

javax.xml.stream.events.StartElement.class

所以,当你尝试创建apk文件,它会告诉你是这样的:

[apply] trouble processing "javax/xml/stream/events/StartElement.class": 
[apply] 
[apply] Ill-advised or mistaken usage of a core class (java.* or javax.*) 
[apply] when not building a core library. 
[apply] 
[apply] This is often due to inadvertently including a core library file 
[apply] in your application's project, when using an IDE (such as 
[apply] Eclipse). If you are sure you're not intentionally defining a 
[apply] core class, then this is the most likely explanation of what's 
[apply] going on. 
[apply] 
[apply] However, you might actually be trying to define a class in a core 
[apply] namespace, the source of which you may have taken, for example, 
[apply] from a non-Android virtual machine project. This will most 
[apply] assuredly not work. At a minimum, it jeopardizes the 
[apply] compatibility of your app with future versions of the platform. 
[apply] It is also often of questionable legality. 
[apply] 
[apply] If you really intend to build a core library -- which is only 
[apply] appropriate as part of creating a full virtual machine 
[apply] distribution, as opposed to compiling an application -- then use 
[apply] the "--core-library" option to suppress this error message. 
[apply] 
[apply] If you go ahead and use "--core-library" but are in fact 
[apply] building an application, then be forewarned that your application 
[apply] will still fail to build or run, at some point. Please be 
[apply] prepared for angry customers who find, for example, that your 
[apply] application ceases to function once they upgrade their operating 
[apply] system. You will be to blame for this problem. 
[apply] 
[apply] If you are legitimately using some code that happens to be in a 
[apply] core package, then the easiest safe alternative you have is to 
[apply] repackage that code. That is, move the classes in question into 
[apply] your own package namespace. This means that they will never be in 
[apply] conflict with core system classes. JarJar is a tool that may help 
[apply] you in this endeavor. If you find that you cannot do this, then 
[apply] that is an indication that the path you are on will ultimately 
[apply] lead to pain, suffering, grief, and lamentation. 
相关问题