2014-12-06 152 views
1

我已經創建了一個phonegap項目並通過以下http://docs.phonegap.com/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface本文檔添加了android平臺。 當我試圖用這個命令來構建它:構建Phonegap應用程序時出錯

科爾多瓦建設 或 科爾多瓦構建Android

我得到這個錯誤。

/usr/android/android-sdk-linux/tools/ant/build.xml:698: Execute failed: java.io.IOException: Cannot run program "/usr/android/android-sdk-linux/build-tools/19.1.0/aapt" (in directory "/home/keshav/Desktop/workspace/phonegap/hello/platforms/android/CordovaLib"): error=2, No such file or directory 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) 
at java.lang.Runtime.exec(Runtime.java:617) 
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862) 
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481) 
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495) 
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631) 
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672) 
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498) 
at com.android.ant.AaptExecTask.execute(AaptExecTask.java:699) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) 
at com.android.ant.IfElseTask.execute(IfElseTask.java:120) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Target.execute(Target.java:390) 
at org.apache.tools.ant.Target.performTasks(Target.java:411) 
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) 
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) 
at org.apache.tools.ant.Project.executeTargets(Project.java:1251) 
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) 
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302) 
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) 
at com.android.ant.IfElseTask.execute(IfElseTask.java:120) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 
at org.apache.tools.ant.Target.execute(Target.java:390) 
at org.apache.tools.ant.Target.performTasks(Target.java:411) 
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) 
at org.apache.tools.ant.Project.executeTarget(Project.java:1368) 
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
at org.apache.tools.ant.Project.executeTargets(Project.java:1251) 
at org.apache.tools.ant.Main.runBuild(Main.java:809) 
at org.apache.tools.ant.Main.startAnt(Main.java:217) 
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 
Caused by: java.io.IOException: error=2, No such file or directory 
at java.lang.UNIXProcess.forkAndExec(Native Method) 
at java.lang.UNIXProcess.<init>(UNIXProcess.java:186) 
at java.lang.ProcessImpl.start(ProcessImpl.java:130) 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) 
... 68 more 

Total time: 1 second 

/home/keshav/Desktop/workspace/phonegap/hello/platforms/android/cordova/node_modules/q/q.js:126 
       throw e; 
        ^
Error code 1 for command: ant with args: debug,-f,/home/keshav/Desktop/workspace /phonegap/hello/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen 
Error: /home/keshav/Desktop/workspace/phonegap/hello/platforms/android/cordova/build: Command failed with exit code 8 
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) 
at ChildProcess.emit (events.js:98:17) 
at maybeClose (child_process.js:756:16) 
at Process.ChildProcess._handle.onexit (child_process.js:823:5) 
+0

你安裝ANT和ANT加斌的路徑變量的路徑? – AtanuCSE 2014-12-06 17:31:44

+0

@AtanuCSE是的,螞蟻,android和java路徑已經設置路徑變量。 – 2014-12-06 17:36:01

+0

可能是重複的:http://stackoverflow.com/q/26783594/814416和http://stackoverflow.com/q/20897115/814416 – sherb 2014-12-07 01:24:50

回答

相關問題