javax/net/SocketFactory.class 转换为 Dalvik 格式失败,错误 1

发布于 2024-09-10 16:03:29 字数 1346 浏览 8 评论 0原文

尝试在控制台中获取此类输出的构建项目时遇到此问题:

[2010-07-19 23:29:23 - myProject]
trouble processing "javax/net/SocketFactory.class":
[2010-07-19 23:29:23 - myProject] 
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2010-07-19 23:29:23 - myProject] 1 error; aborting
[2010-07-19 23:29:23 - myProject] Conversion to Dalvik format failed with error 1

我正在寻找我的项目以使用 javax 包,但没有找到,清理所有也没有帮助。我做错了什么?

更新

抱歉,大家,但我找不到好的解决方案,我想强调一个事实,我根本不在我的项目中使用 SocketFactory 类!在这个问题之前源代码没有改变,这就是为什么我认为这个问题出现在 eclipse 或 adt 或其他东西中,但是如果我使用 ant(由 sdk 生成)来构建这个项目,那就没有问题了!

我通过删除 Eclipse、Android SDK、Eclipse 工作区来解决这个问题,然后重新安装它们,之后一切正常。

希望这会对某人有所帮助。

Encounter this problem when trying to Build Project getting such output in console:

[2010-07-19 23:29:23 - myProject]
trouble processing "javax/net/SocketFactory.class":
[2010-07-19 23:29:23 - myProject] 
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2010-07-19 23:29:23 - myProject] 1 error; aborting
[2010-07-19 23:29:23 - myProject] Conversion to Dalvik format failed with error 1

I was looking for my project to use the package javax, not found, clean all also does not help. what I am doing wrong?

Update

Sorry guys, but I could not find good fix for that, I want to emphasize the fact, that i dont use SocketFactory class in my project at all! source code was not changed before this problem, and that's why i think that problem in eclipse or adt or something else, BUT if i use ant(generated by sdk) to build this project there is no problem!!!

I solve this problem by removing Eclipse, Android SDK, Eclipse workspace, and just reinstall them, after this all works fine for now.

Hope this will help someone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

鹊巢 2024-09-17 16:03:29

我有同样的问题..
这对我有用
项目-->属性->java构建路径->库->删除所有包括 android jars

现在进入项目浏览器,右键单击您正在处理的项目,
然后android工具--->修复项目属性...
进行清理,然后构建...

I had the same problem..
This worked for me
project-->properties->java build path->libraries-> remove all including android jars

now go the project browser, right click on the project you are working on,
then android tools---> fix project properties...
do a clean and then build...

逆流 2024-09-17 16:03:29
  • 我解决了这个问题(至少对我来说)。

这就是我所做的:

  • 转到项目»属性»Java构建路径»库
  • 删除除“Android XY”之外的所有内容,然后单击“确定”。
  • 转到项目 » 清理 » 清理下面选择的项目 » 选择您的项目,然后单击确定。

这对我来说很有效。
希望它也适合你

更新:好吧,实际上我可能不得不收回我的意见..这些操作删除了错误消息,但现在我缺少某些类和方法...arggghhhh

  • I solved the problem (at least for me).

Here's what I did:

  • Go to Project » Properties » Java Build Path » Libraries
  • Remove all except the "Android X.Y" click OK.
  • Go to Project » Clean » Clean projects selected below » select your project and click OK.

That did the trick for me.
Hope it works for you as well

Update: well actually I might have to retract my opinion.. the actions removed the error messages but now I am missing certain classes and methods... arggghhhh

柠栀 2024-09-17 16:03:29

我刚刚重新启动Eclipse,错误就不再出现了!

I just restarted Eclipse, and the error didn't appear anymore!

喜爱纠缠 2024-09-17 16:03:29

我遇到了同样的问题,解决方法如下:

  1. 首先清理所有罐子; (这个问题一定是因为你的一些jar)
  2. 删除项目;
  3. 重新导入项目;
  4. 确保您的sdk正确,项目选择一个sdk版本;
  5. (这是我解决问题的问题)右键单击您的项目,然后选择“build-path”,接下来选择“add Librarys”,然后添加您的私有jar;
    clean-build,问题已解决;

I had the same problem,and solved it as follows:

  1. First clean all jars; (This problem must because your some jars)
  2. Delete the project;
  3. Reimport project;
  4. Make sure your sdk is right, and project select one sdk version;
  5. (This is my issue to solve the problem) Right click your project, and select "build-path", next select "add Librarys", and add your private jars;
    clean-build, the problem has fixed;
我也只是我 2024-09-17 16:03:29

我刚刚遇到了同样的问题,我尝试了这里列出的所有解决方案,但没有成功(我开始生气)。然后我把项目从工作区中删除,然后再次导入,就没有问题了!

I just had the same problem and I tried all of the solutions listed here with no success (I was starting to get annoyed). Then I removed the project from the workspace and then imported it again, and there were no problems!

苏大泽ㄣ 2024-09-17 16:03:29

这发生在我身上,

我有一个很旧的项目,今天我必须重新开始工作。我基本上在每个需要处理大量图像的项目中使用“通用图像下载器”库。因此,在这个旧项目中,我将“通用图像下载器”的源文件包含在其“src”路径中。那时我还是个新手,慢慢地我开始开发自己的库,它可以非常轻松地处理日常简单的 Android 开发任务。显然我在其中包含了“通用图像下载器”。

今天清理旧项目后,我做的第一件事就是引用我的库来加快开发过程,但当我尝试调试时,我一遍又一遍地遇到“转换为 Dalvik 格式失败,错误 1”。首先,我认为这是支持库,但即使在清除所有库并仅添加我的库并快速执行“修复项目属性”后,我仍然得到它。在尝试了各种解决方案后,我在控制台中注意到了这一点“java.lang.IllegalArgumentException:已添加:Lcom/nostra13/universalimageloader/cache/disc/BaseDiscCache;”

就这么简单......我正在尝试编译一个已经编译过的类。

解决方案:我只是简单地从“src”目录中删除了从“Universal Image Downloader”库中获得的所有类文件。由于我的库引用了“Universal Image Downloader”库,旧项目开始工作得很好。

This happened to me this way,

I have a quite an old project which I had to start working again today. I use 'Universal Image Downloader' library for basically every project where I have to deal with lots of images. So in this old project I had the source files of 'Universal Image Downloader' included to it's 'src' path. Back then I was a newbie and slowly I started developing my own library which could handle every day simple Android development tasks very easily. Obviously I included the 'Universal Image Downloader' to this.

After dusting off the old project today the first thing I did was to reference my library to speed up the development process but as I was trying to debug I ran into the "Conversion to Dalvik format failed with error 1" over and over again. First I thought it was the support library but even after clearing all libraries and adding only mine and doing a quick 'Fix project properties' I still got it. After trying various solutions I noticed this in the console "java.lang.IllegalArgumentException: already added: Lcom/nostra13/universalimageloader/cache/disc/BaseDiscCache;"

It was as simple as that... I'm trying to compile a class which has already been compiled.

Solution : I just simply removed all the class files I got from 'Universal Image Downloader' library from the 'src' directory. Since my library references "Universal Image Downloader" library the old project started working just fine.

我也只是我 2024-09-17 16:03:29

当尝试运行导入到 eclipse 中的示例项目时,遇到日志中显示的相同问题。

附加信息:在 eclipse 的问题视图中,我看到以下错误:

“在解决构建路径错误之前,无法构建项目”

在我的情况下,导入的项目找到了正确的库(正确的意思是我可以看到到的外部路径在本例中,每个 android 库有 2 个库(android.jar 和maps.jar)。所以在我的例子中没有对库进行洗牌,但这可能是你的问题。

我按照 Spock 的建议清理了这个项目,我必须清理多次,直到它以某种方式解决问题。之后,问题解决了,我必须为要运行的项目指定一个 AVD,很快就在模拟器上启动并运行。另请注意,我的 Eclipse 设置为“自动构建”。

就我而言,我没有丢失任何类文件或清理后的任何内容,因为构建正确生成了它们。

问候!

Hit same problem shown on your log when trying to run an example project which was imported into eclipse.

Additional Info: in eclipse's Problems View I see the following error:

"The project cannot be built until build path errors are resolved"

In my case the imported project find the libraries just right(by just right I mean I can see the external path to each of the android libs in this case 2 libs, android.jar and maps.jar). So no shuffling of libs in my case, but might be your problem.

I followed Spock's suggestion of cleaning the project which I had to clean multiple times until it somehow resolve its issues. After, issue was solved I had to specify an AVD for the project to run and soon after was up and running on the emulator. Also, note that my eclipse is set up to Build Automatically.

In my case I'm not missing any class files or anything after the clean as the build is properly generating them.

Regards!

那片花海 2024-09-17 16:03:29

我遇到了同样的错误。我的问题是我有一个 Android 设备连接来调试。当我拔掉插头后,我就可以导出了。

I was getting the same error. My problem was that i had an android device hooked up to debug with. As soon as I unplugged it I was able to export.

美羊羊 2024-09-17 16:03:29

我找到的答案是检查项目属性中的源代码和库构建路径。最有可能的是,在源和库选项卡中引用的内容中会出现重复。因此,删除源选项卡中的额外内容,然后清理项目,就可以开始了。

The answer I found was checking the source and library build path in the project's properties. Most likely there will be a duplicate as in something being referenced in both the source and library tabs. So delete the extra in the source tab and then clean the project and you should be good to go.

猫九 2024-09-17 16:03:29

要么:

  • javax.net.SocketLibrary 位于您的源代码中,或者
  • javax.net.SocketLibrary 包含在项目的 JAR 文件中

Either:

  • javax.net.SocketLibrary is in your source code, or
  • javax.net.SocketLibrary is included in a JAR file in your project
我乃一代侩神 2024-09-17 16:03:29

在某些情况下,它的内裤会发生扭曲,我发现的最佳解决方案是删除引用的罐子,清理,将它们添加回来,然后再次编译。

我相信该错误可能是由于两次包含相同的类而引起的。

当使用不属于 Android 环境的类时,也会发生此错误(并且您无法通过清理来消除它)。

Under certain conditions it gets its knickers in a twist and the best fix I've found is to remove referenced jars, clean, add them back in and then compile again.

I believe the error can be caused by including the same classes twice.

This error will also occur (and you won't be able to get rid of it by cleaning) when using classes that are not part of the Android environment.

三人与歌 2024-09-17 16:03:29

总结 bimbim.in 提供的链接中的信息(当我浏览它时我的理解)

  • Android Davik VM 尝试编译 jar,但发现一些无法编译为 .dex 文件的内容

,因此

  • 只需创建一个“lib” ” 项目根目录中的目录(src、bin res 目录所在的位置)并将它们添加到构建路径中。项目属性... Java 构建路径... 库.. 添加 JAR..

To summarise the information in the link bimbim.in provided (well my understanding when I glanced over it)

  • The Android Davik VM tries to compile the jars but finds some stuff that it can't compile to .dex files

so

  • Just create a "lib" directory in the root of the project (where the src, bin res directories are) and add them to the build path. Project Properties... Java Build Path... Libraries.. Add JARs..
浮生面具三千个 2024-09-17 16:03:29

我可以通过创建一个新项目来解决此问题,看起来某些项目设置正在创建此问题,但无法真正找到其根本原因。但是,将现有源代码转储到新项目中解决了这个问题。如果有人找到此问题的根本原因,请告诉我。

I could resolve this issue by creating a new project, looks like the some project settings were creating this issue and could not really find the root cause for that. But, dumping the existing source code onto the new project resovled this issue. If anyone has found the root cause for this problem pls do let me know.

执手闯天涯 2024-09-17 16:03:29

我遇到了同样的问题并解决如下:
- 转到 Project/Properties/Java Build Path/Libraries 并删除除 Android 之外的所有 JAR
- 清理项目
- 再次添加 JAR 作为外部 JAR(我第一次在内部添加它们,所以这可能是问题所在)
之后错误就消失了。

I had the same problem and solved it as follows:
- Go to Project/Properties/Java Build Path/Libraries and remove all JARs except Android
- Do a project clean
- Add the JARs again as External JARs (first time I added them internally, so that might be the problem)
After that the error was gone.

嗳卜坏 2024-09-17 16:03:29

我通过更新 Android SDK 和 AVD 管理器中的可用包解决了这个问题。无需删除 Eclipse。

I solved the problem by updating available packages in the Android SDK et AVD manager. No need to remove Eclipse.

还在原地等你 2024-09-17 16:03:29

每当项目拥有雄心勃勃的数据时。造成这个问题。可能是android无法找到选择哪一个。

Whenever the Project is having the ambitious data. This problem is caused. May be android can't able to find which one choose.

负佳期 2024-09-17 16:03:29

据我了解,同样的神秘错误可能是由多种原因引起的。我也遇到了“转换为 Dalvik 格式失败,错误 1”错误。就我而言,问题是由于某种原因 Project ->属性-> Java 编译器未使用正确的 Java 1.5 设置设置为“启用项目特定设置”,而是保留为默认值(在我的例子中为 1.6)。在设备/模拟器上调试、构建和测试工作正常,但导出总是失败并出现上述错误消息。

如果不确定设置是否正确,请在某个替代位置创建相同的项目,然后将所有需要的文件从旧项目复制到新项目中。这为我解决了这个问题。

具有相同错误消息的下一个问题来自使用 proguard。通过替换 android sdk 附带的版本更新到最新版本,修复了该问题。

希望这有帮助

From what I understand, this same cryptic error could be caused from a wide variety of reasons. I've got "Conversion to Dalvik format failed with error 1" error too. In my case the problem was that for some reason Project -> Properties -> Java Compiler was not set to "Enable project specific settings" with proper Java 1.5 settings, but was left to defaults instead (1.6 in my case). Debug, build and test on devices/emulators worked fine, but export always failed with the above error message.

If unsure about the proper settings, create the same project on some alternative location and just copy all needed files from the old project into the new one. This fixed the issue for me.

The next problem with the same error message came from using proguard. Updating to the latest version by replacing the one that came with android sdk, fixed that.

Hope this helps

淡水深流 2024-09-17 16:03:29

我的问题是我的 src 文件夹中有一个 jar 文件。从构建路径中删除 jar 是可行的,但前提是您不需要相关的 jar。对于需要相关 jar 的人,请确保您的 jar 文件不在项目文件夹中(可能只是 src 子树,但我会将其分开以进行测试)。将其放在桌面或其他东西上,然后尝试“添加外部 jar..”选项。在添加另一个外部文件之前,请务必从项目文件系统中删除该 jar。两者兼而有之才是问题的根源。

My problem was having a jar file in my src folder. Removing jars from the build path works, but only if you don't need the jar in question. For people who need the jar in question, make sure that your jar file is not in the project folder (maybe just src subtree, but I would keep it separate to test). Put it on your desktop or something and try the "Add external jar.." option. Be sure to remove the jar from the project filesystem before adding another external. Having both is what causes the problem.

宣告ˉ结束 2024-09-17 16:03:29

我已经按照第一个答案的说明完成了它并且它有效。(Linux)
我认为该问题可能是由SDK或ADT更新引起的。
我必须清除 Java 构建路径中的所有库,然后使用 android 工具来修复该项目。清理和重建后,它可以像以前一样工作。

I have done it as the instruction of the first answer and it works.(Linux)
I think the problem may caused by SDK or ADT updates.
I do have to clear all the lib in Java Building path and then use android tools to fix the project. After cleaning and rebuild, it works as before.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文