简体   繁体   English

Android开发-转换为Dalvik格式失败,错误1

[英]Android Development - Conversion to Dalvik format failed with error 1

So I'm dipping my toes into this area for the first time - i followed instructions to install the android SDK and eclipse plug in. I created a blank new android project and I get the following build errors: 因此,我第一次将脚趾伸入该区域-我按照说明安装了android SDK和eclipse插件。我创建了一个空白的新android项目,并遇到以下构建错误:

[2011-01-08 16:34:55 - xxx]: Dxno classfiles specified
[2011-01-08 16:34:55 - xxx] Conversion to Dalvik format failed with error 1

I've googled the problem and tried to clean and rebuild, or hitting F5 on the project in the explorer but the issue remains. 我已经搜索了这个问题,并尝试清理和重建,或者在资源管理器中的项目上按了F5键,但问题仍然存在。 I've verified the build paths and the libraries to make sure only Android 2.3 is there but still get this issue. 我已经验证了构建路径和库,以确保仅存在Android 2.3,但仍然会遇到此问题。

I have also tried to load a sample project and I get the same error. 我也尝试加载示例项目,但出现了同样的错误。

Any ideas? 有任何想法吗?

This problem happens when the java files in the Eclipse project are not compiled to class files. 当Eclipse项目中的java文件未编译为类文件时,会发生此问题。 The message indicates that the Android SDK cannot proceed to convert these classes to dalvik format because it could not find them. 该消息指示Android SDK无法继续将这些类转换为dalvik格式,因为找不到它们。 To solve this problem: 解决此问题的方法:

  1. Verify that the src folder is in your build path ( check under "Project Properties" -> "Java build path" ). 确认src文件夹在您的构建路径中(检查“项目属性”->“ Java构建路径”下的内容)。 If this is not the case right-click on the src folder, go to "Build path" and click on "Use as source folder". 如果不是这种情况,请右键单击src文件夹,转到“构建路径”,然后单击“用作源文件夹”。
  2. Verify that under "Project properties" -> "Builders" you can find "Java builder". 确认在“项目属性”->“构建器”下可以找到“ Java构建器”。 If this is not the case close the project and with a text editor open the file .project present in the root folder of the project itself. 如果不是这种情况,请关闭项目,然后使用文本编辑器打开项目本身的根文件夹中.project文件。 Add under <buildSpec> the following lines: <buildSpec>下添加以下行:

     <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments></arguments> </buildCommand> 

    After performing the actions described above, re-open the project and proceed to rebuild it by clicking on "Project" -> "Clean" 执行完上述操作后,请重新打开项目,然后通过单击“项目”->“清理”继续进行重建。

I fixed this - none of the above helped. 我已解决此问题-以上均无济于事。

What i did was delete eclipse, download the latest one and reinstalled the ADT plugin and it works now. 我所做的就是删除eclipse,下载最新的Eclipse,然后重新安装了ADT插件,现在可以使用了。

Simply edit the "project.properties" file and comment the line: 只需编辑“ project.properties”文件并注释以下行:

proguard.config=proguard.cfg

to be like the following: 如下所示:

#proguard.config=proguard.cfg

then clean the project. 然后清理项目。 Hope this will export to APK successfully. 希望这将成功导出到APK。

The answer is detailed here . 答案在这里详细说明。 Try these steps, and it should work out. 尝试这些步骤,它应该可以解决。

I had the same problem: try to clean the project (Project -> Clean...). 我遇到了同样的问题:尝试清理项目(Project-> Clean ...)。 Eclipse will recreate the right bin directory. Eclipse将重新创建正确的bin目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM