phonegap运行android失败,“... \ classes.dex不存在”

时间:2014-02-19 20:28:48

标签: android cordova build

刚刚在Windows 7 64bit上安装了phonegap并运行了:

phonegap create testpg 
cd testpg 
phonegap -V run andoid 

最后一个命令将中止,并显示以下错误消息:

[phonegap] detecting Android SDK environment... 
[phonegap] using the local environment 
[phonegap] compiling Android... 
[phonegap] Generating config.xml from defaults for platform "android" 
[phonegap] Compiling app on platform "android" via command "cmd" /c D:\Dev\projects\testpg\platforms\android\cordova\build 
[error] An error occurred while building the android project.Error executing "ant debug -f "D:\Dev\projects\testpg\platforms\android\build.xml"": 
BUILD FAILED 
D:\Dev\sdk\tools\ant\build.xml:962: The following error occurred while executing this line: 
D:\Dev\sdk\tools\ant\build.xml:973: The following error occurred while executing this line: 
D:\Dev\sdk\tools\ant\build.xml:313: com.android.sdklib.build.ApkCreationException: java.io.FileNotFoundException: D:\Dev\projects\testpg\platforms\android\bin\classes.dex does not exist 

有谁知道发生了什么以及如何解决这个问题?

提前致谢!

PS。我试着运行“ant debug -f”D:\ Dev \ projects \ testpg \ platforms \ android \ build.xml“”:

它提供了相当详细的输出。这是最后一部分:

...................... 
-dex: 
[dex] input: D:\Dev\projects\testpg\platforms\android\bin\classes 
[dex] input: D:\Dev\projects\testpg\platforms\android\CordovaLib\bin\classes.jar 
[dex] Pre-Dexing D:\Dev\projects\testpg\platforms\android\CordovaLib\bin\classes.jar -> classes-529c048069aff9da86f06bdc712f5b33.jar 
[dex] Found Deleted Target File 
[dex] Converting compiled files and external libraries into D:\Dev\projects\testpg\platforms\android\bin\classes.dex... 

-crunch: 
[crunch] Crunching PNG Files in source dir: D:\Dev\projects\testpg\platforms\android\res 
[crunch] To destination dir: D:\Dev\projects\testpg\platforms\android\bin\res 
[crunch] Crunched 0 PNG files to update cache 

-package-resources: 
[aapt] Creating full resource package... 
[aapt] Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/an...); using existing value in 
manifest. 

-package: 
[apkbuilder] Current build type is different than previous build: forced apkbuilder run. 
[apkbuilder] Creating HelloWorld-debug-unaligned.apk and signing it with a debug key... 

BUILD FAILED 
D:\Dev\sdk\tools\ant\build.xml:962: The following error occurred while executing this line: 
D:\Dev\sdk\tools\ant\build.xml:973: The following error occurred while executing this line: 
D:\Dev\sdk\tools\ant\build.xml:313: com.android.sdklib.build.ApkCreationException: java.io.FileNotFoundException: D:\Dev\projects\testpg\platforms\android\bin\classes.dex does not exist 
.................... 
有趣的是,有一行说“[dex]将编译后的文件和外部库转换为D:\ Dev \ projects \ testpg \ platforms \ android \ bin \ classes.dex ...”但最终构建失败“java.io.FileNotFoundException:D:\ Dev \ projects \ testpg \ platforms \ android \ bin \ classes.dex不存在”

1 个答案:

答案 0 :(得分:0)

尝试重建项目.. 转到Build>制作项目(ctrl + f9)。 并再次运行 它对我有用..