运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar

在ecplise上运行项目,今天一运行就提示这个错误:Your project contains error(s), please fix them before running your application.(你的程序包含错误,请修改后再运行)。咋一看,以为代码哪里写错了,其实并不是,代码在同事电脑上运行过,是不报错的:

运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar_第1张图片
image

控制台是这样输出的:

[2018-01-17 17:11:52 - Dex Loader] Failed to load D:\Android\sdk\build-tools\26.0.0\lib\dx.jar
[2018-01-17 17:11:52 - api19] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
[2018-01-17 17:12:11 - Dex Loader] Failed to load D:\Android\sdk\build-tools\26.0.0\lib\dx.jar
[2018-01-17 17:12:11 - api19] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!

提示dx.jar文件没加载到,按网上一些方法试了也不行,我就找到D:\Android\sdk\build-tools\这个目录,目录如下图,我想,既然他找不到26.0.0这个文件夹,那我就把它删了。我把26.0.0文件夹剪切放到别的位置备份(比如桌面),以免出错再恢复回来。再次打开eclipse运行就成功了

运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar_第2张图片
image

删了后的目录图:

运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar_第3张图片
image

也是很简单的解决了这个问题

你可能感兴趣的:(运行错误提示 Failed to load D:\Android\sdk\build-tools\26.0.0-preview\lib\dx.jar)