【问题标题】:phonegap run android fails with "...\classes.dex does not exist"phonegap run android 因“...\classes.dex 不存在”而失败
【发布时间】:2014-02-19 20:28:47
【问题描述】:

刚刚在 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 不存在”

【问题讨论】:

  • 尝试运行%userprofile%\.cordova\lib\android\cordova\3.3.0\bin\check_reqs.bat 看它是否显示“看起来您的环境完全支持cordova-android 开发!”或别的什么。

标签: android cordova build


【解决方案1】:

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

【讨论】:

  • 为什么?发生了什么变化?
猜你喜欢
  • 1970-01-01
  • 2022-11-29
  • 2020-05-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-10
相关资源
最近更新 更多