现象:
A problem occurred configuring root project 'android'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:1.0.0+. Required by: :android:unspecified > No cached version listing for com.android.tools.build:gradle:1.0.0+ available for offline mode. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. D:\baiduyundownload\WeX5_V34\model\Native\浠挎窐瀹漒build\src\platforms\android\cordova\node_modules\q\q.js:126 throw e; ^ Error code 1 for command: cmd with args: /s /c "D:\baiduyundownload\WeX5_V34\model\Native\浠挎窐瀹漒build\src\platforms\android\gradlew cdvBuildRelease -b D:\baiduyundownload\WeX5_V34\model\Native\浠挎窐瀹漒build\src\platforms\android\build.gradle -Dorg.gradle.daemon=true --offline" ERROR building one of the platforms: Error: cmd: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: cmd: Command failed with exit code 1 ****ERROR****: 子任务 "exec" 执行失败。 ****ERROR****: 任务 "buildAndroid" 执行失败。 ****ERROR****: 执行出错: ****ERROR****: 错误信息: exec returned: 1 ****ERROR****: 如不能确定具体问题,可参考常见问题: http://wex5.com/cn/bbs/thread-82002-1-1.html
解决方案:
修改Native下自己工程下的build.properties文件, 找到
#offline=false
改成
offline=false
如果没有找到#offline=false, 在build.properties的最行添加offline=false
要求:打包时,电脑必须能联外网,这时需要到外网下载一些打包依赖的资源。
评一波