完成phonegap安装后,我创建了一个phonegap项目并尝试构建它。我得到以下错误。
username@userpc:~/phonegap/testapp$ cordova build
cp: no such file or directory: /home/username/phonegap/testapp/icon.png
Running command: /home/username/phonegap/testapp/platforms/android/cordova/build
/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error: ENOENT, no such file or directory '/home/username/android-sdk-linux/tools/tools/lib/build.template'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at /home/username/phonegap/testapp/platforms/android/cordova/lib/build.js:120:40
at _fulfilled (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:760:13)
at /home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:574:44
at flush (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
ERROR building one of the platforms: Error: /home/username/phonegap/testapp/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
当我运行phonegap build
时,它会给我低于输出但应用程序不起作用。
username@userpc:~/phonegap/testapp$ phonegap build
[phonegap] executing 'cordova build'...
[phonegap] completed 'cordova build'
我该如何解决这个问题?
答案 0 :(得分:6)
首先,您必须决定是否要坚持使用Phonegap或Cordova CLI。不要把它们混合在一起,这只会让你陷入困境。如果您需要Adobe提供的专有Phonegap-Build-Service支持,则需要Phonegap,否则您可以使用Cordova。
如果你想坚持使用Phonegap,用phonegap create <project>
创建一个项目,添加android平台(phonegap platform add android
),然后使用phonegap build android
构建它。
我猜你没有正确设置Android SDK的路径变量,因为它正在寻找路径&#39; / home / username / android-sdk-linux /中的构建模板工具/工具 /lib/build.template' ;.
我建议您设置路径变量,如另一篇帖子here中所述。