这是netbeans在运行新的cordova应用程序时预先生成的代码。第5行在netbeans中引发错误,表示未注册关键字msapplication-tap-highlight。另外,在第19行中,cordova项目中不存在cordova.js文件。当我尝试通过Android模拟器运行应用程序时,它给我一个构建失败的消息。在html文件下面编写失败的消息。我尝试通过命令行在android模拟器中启动html文件,但是
/Users/Programming/Desktop/Coding/GenericApp/www/index.html: Permission denied
此外,在Build Failed消息底部建议的命令“android”在我的终端中什么也没做。如何解决任何上述问题的任何建议将不胜感激。
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
ant -f /Users/Programming/Desktop/Coding/GenericApp/nbproject "-Dupdate.task.jar=/Applications/NetBeans/NetBeans 8.0.1.app/Contents/Resources/NetBeans/webcommon/ant/extra/org-netbeans-modules-cordova-projectupdate.jar" -Dandroid.project.activity=GenericApp -Dsite.root=www -Dstart.file=index.html -Dandroid.sdk.home=/Users/Programming/Library/Android/sdk -Dandroid.target.device.arg=emulate -Dcordova.version=4.2.0-0.0.0 -Denv.DISPLAY=:0.0 "-Dios.certificate.name=iPhone Developer" -Dandroid.build.target=android-21 -Dconfig=android sim-android
check-android-template:
check-cordova-version:
check-cordova-project:
upgrade-to-cordova-project:
create-android:
cordova -d platform add android
Creating android project...
Running command: /Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create --cli /Users/Programming/Desktop/Coding/GenericApp/platforms/android com.coolappz.GenericApp GenericApp
Command finished with error code 1: /Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create --cli,/Users/Programming/Desktop/Coding/GenericApp/platforms/android,com.coolappz.GenericApp,GenericApp
/Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:126
throw e;
^
Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.
at /Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:174:19
at _fulfilled (/Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13)
at /Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:574:44
at flush (/Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
Error: /Users/Programming/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
/Users/Programming/Desktop/Coding/GenericApp/nbproject/build.xml:150: exec returned: 1
BUILD FAILED (total time: 10 seconds)
答案 0 :(得分:0)
错误msapplication-tap-highlight
在编辑器中是错误的错误,对于是否或如何构建应用程序没有任何影响。
Please install Android target "android-19".
是来自Cordova的消息,您可能需要下载适用于Android 4.4的特定Android SDK(也称为Android API等级19)。
关于遗失的cordova.js
,我认为它在构建过程中被Cordova添加到项目中,并且不需要担心。
权限错误我不知道:)但似乎index.html没有设置正确的权限。