NetBeans 8.2 Cordova应用程序编译问题:未找到Gradle包装器

时间:2017-04-22 18:19:29

标签: android cordova gradle netbeans-8

我正在尝试在我的Android设备上运行随NetBeans 8.2提供的Cordova示例。 关于我的机器配置

  • 操作系统:Windows 7 64位

  • Android Studio最新SDK版本安装了API级别25,修订版3

  • NetBeans 8.2

然而,构建失败,这是完整的构建日志。有人可以帮助诊断问题吗?

    ant -f C:\\Users\\xxx\\Documents\\NetBeansProjects\\CordovaMapsSample\\nbproject "-Dupdate.task.jar=C:\\Program Files\\NetBeans 8.2\\webcommon\\ant\\extra\\org-netbeans-modules-cordova-projectupdate.jar" -Dandroid.project.activity=CordovaMapsSample -Dsite.root=www -Dstart.file=index.html -Dandroid.sdk.home=C:\\Users\\xxx\\AppData\\Local\\Android\\Sdk -Dandroid.target.device.arg=run -Dcordova.version=6.5.0-0.0.0 -Denv.DISPLAY=:0.0 "-Dios.certificate.name=iPhone Developer" -Dandroid.build.target=android-19 -Dconfig=android_1 build-android
check-android-template:
check-cordova-version:
check-cordova-project:
upgrade-to-cordova-project:
create-android:
update-plugins:
cordova.cmd plugins 
cordova.cmd -d plugin remove cordova-plugin-whitelist
No scripts found for hook "before_plugin_rm".
Calling plugman.uninstall on plugin "cordova-plugin-whitelist" for platform "android"
Running command: cmd "/s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat""
Command finished with error code 0: cmd /s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat"
Finding scripts for "before_plugin_uninstall" hook from plugin cordova-plugin-whitelist on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling cordova-plugin-whitelist from android
Beginning processing of action stack for android project...
Action stack processing complete.
Removing "cordova-plugin-whitelist"
Deleted "cordova-plugin-whitelist"
Removing plugin cordova-plugin-whitelist from fetch.json
No scripts found for hook "after_plugin_rm".
cordova.cmd -d plugin remove cordova-plugin-compat
No scripts found for hook "before_plugin_rm".
Calling plugman.uninstall on plugin "cordova-plugin-compat" for platform "android"
Running command: cmd "/s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat""
Command finished with error code 0: cmd /s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat"
Error: CordovaError: The plugin 'cordova-plugin-compat' is required by (cordova-plugin-contacts, cordova-plugin-geolocation), skipping uninstallation. (try --force if trying to update)
    at runUninstallPlatform (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\uninstall.js:272:30)
    at C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\uninstall.js:96:16
    at _fulfilled (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\node_modules\q\q.js:816:13)
    at C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\node_modules\q\q.js:624:44
    at runSingle (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\node_modules\q\q.js:137:13)
    at flush (C:\Users\xxx\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Result: 1
build-android:
cordova.cmd -d build android
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\assets\www
  copy  platforms\android\platform_www\cordova_plugins.js platforms\android\assets\www\cordova_plugins.js (updated file)
Wrote out android application name "CordovaMapsSample" to C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.coolappz.CordovaMapsSample" to C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\src\com\coolappz\CordovaMapsSample\MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
Prepared android project successfully
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "cordova-plugin-whitelist@1"
Fetching plugin "cordova-plugin-whitelist@1" via npm
Copying plugin "C:\Users\xxx\.cordova\lib\npm_cache\cordova-plugin-whitelist\1.3.2\package" => "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\plugins\cordova-plugin-whitelist"
Calling plugman.install on plugin "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\plugins\cordova-plugin-whitelist" for platform "android
Installing "cordova-plugin-whitelist" for android
Running command: cmd "/s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat""
Command finished with error code 0: cmd /s /c "C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\version.bat"
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-whitelist on android platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-whitelist" on android.
Beginning processing of action stack for android project...
Action stack processing complete.
Install complete for cordova-plugin-whitelist on android.

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-whitelist on android platform only.
No scripts found for hook "after_plugin_install".
No scripts found for hook "after_plugin_add".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Users\xxx\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_77
Error: CordovaError: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: C:\Users\xxx\AppData\Local\Android\Sdk\tools\templates\gradle\wrapper
    at Object.module.exports.check_gradle (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\lib\check_reqs.js:90:25)
    at GradleBuilder.prepEnv (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\lib\builders\GradleBuilder.js:161:23)
    at Api.module.exports.run (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\lib\build.js:152:20)
    at C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\Api.js:348:43
    at _fulfilled (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:796:13)
    at C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:604:44
    at runSingle (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\platforms\android\cordova\node_modules\q\q.js:125:13)
C:\Users\xxx\Documents\NetBeansProjects\CordovaMapsSample\nbproject\build.xml:264: exec returned: 1
BUILD FAILED (total time: 14 seconds)

1 个答案:

答案 0 :(得分:0)

找到一个解决方案,但它确实有效,但我不确定这是否是最好的方法

  1. 下载最新的android sdk工具,例如tools_r25.2.3-windows
  2. 提取相同的
  3. 复制模板文件夹(\ tools_r25.2.3-windows \ tools \ templates)并粘贴 \ AppData \ Local \ Android \ Sdk \ tools文件夹
  4. 编译成功,我能够在设备上运行二进制文件。