首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在mfp cordova上运行-p android时出现错误gradle

在mfp cordova上运行-p android时出现错误gradle
EN

Stack Overflow用户
提问于 2016-03-14 21:29:01
回答 1查看 153关注 0票数 1

当我想用以下命令在我的设备上运行我的应用程序时,MobileFirst Foundation7.1出现错误: mfp cordova run -p android:

代码语言:javascript
复制
ERROR running one or more of the platforms: Error: C:\projects\profondeur\trunk\platforms\android\cordova\run.bat: Command failed with exit code 8
You may not have the required environment or OS to run this project
mobilefirst-cli verb cordova_run error stack: "Error: FAILURE: Build failed with an exception.\r\n\r\n* Where:\r\nBuild file 'C:\\projects\\profondeur\\trunk\\platforms\\android\\build.gradle' line: 3\r\n\r\n* What went wrong:\r\nA problem occurred evaluating root project 'android'.\r\n> Gradle version 2.2 is required.
Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in C:\\projects\\profondeur\\trunk\\gradle\\wrapper\\gradle-wrapper.properties to gradle-2.2-all.zip\r\n\r\n* Try:\r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\r\n\r\nC:\\projects\\profondeur\\trunk\\platforms\\android\\cordova\\node_modules\\q\\q.js:126\r\n                    throw e;\r\n                          ^\r\nError code 1 for command: cmd with args: /s,/c,C:\\projects\\profondeur\\trunk\\platforms\\android\\gradlew,build,-b,C:\\projects\\profondeur\\trunk\\platforms\\android\\build.gradle,-Dorg.gradle.daemon=true,-x,lint,-x,lintVitalRelease,-x,compileLint,-x,copyReleaseLint,-x,copyDebugLint\n    at ChildProcess.<anonymous> (C:\\Program Files\\IBM\\MobileFirst-CLI\\mobilefirst-cli\\node_modules\\cordovacmd\\lib\\cordova-cli.js:253:41)\n    at ChildProcess.emit (events.js:117:20)\nat maybeClose (child_process.js:766:16)\n    at Socket.<anonymous> (child_process.js:979:11)\n    at Socket.emit (events.js:95:17)\n    at Pipe.close (net.js:466:12)"
mobilefirst-cli verb cordova_run error message: "FAILURE: Build failed with an exception.\r\n\r\n* Where:\r\nBuild file 'C:\\projects\\profondeur\\trunk\\platforms\\android\\build.gradle' line: 3\r\n\r\n* What went wrong:\r\nA problem occurred evaluating root project 'android'.\r\n> Gradle version 2.2 is required. Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in C:\\projects\\profondeur\\trunk\\gradle\\wrapper\\gradle-wrapper.properties to gradle-2.2-all.zip\r\n\r\n* Try:\r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\r\n\r\nC:\\projects\\profondeur\\trunk\\platforms\\android\\cordova\\node_modules\\q\\q.js:126\r\n                    throw e;\r\n                          ^\r\nError code 1 for command: cmd with args: /s,/c,C:\\projects\\profondeur\\trunk\\platforms\\android\\gradlew,build,-b,C:\\projects\\profondeur\\trunk\\platforms\\android\\build.gradle,-Dorg.gradle.daemon=true,-x,lint,-x,lintVitalRelease,-x,compileLint,-x,copyReleaseLint,-x,copyDebugLint"
mobilefirst-cli verb cordova_run error code: 0
Error: FAILURE: Build failed with an exception.

* Where:
Build file 'C:\projects\profondeur\trunk\platforms\android\build.gradle' line: 3

* What went wrong:
A problem occurred evaluating root project 'android'.
> Gradle version 2.2 is required. Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in C:\projects\profondeur\trunk\gradle\wrapper\gradle-wrapper.properties to gradle-2.2-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

C:\projects\profondeur\trunk\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s,/c,C:\projects\profondeur\trunk\platforms\android\gradlew,build,-b,C:\projects\profondeur\trunk\platforms\android\build.gradle,-Dorg.gradle.daemon=true,-x,lint,-x,lintVitalRelease,-x,compileLint,-x,copyReleaseLint,-x,copyDebugLint
mobilefirst-cli verb cli error, finish with mobilefirst cordova

我不明白gradle有什么问题?

EN

回答 1

Stack Overflow用户

发布于 2016-03-14 22:22:00

在build.gradle文件中,确保您使用的是最新版本的gradle插件。目前为1.5.0

代码语言:javascript
复制
buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

然后转到platforms/android/gradle/wrapper/gradle-wrapper.properties,并确保distributionUrl值使用的是最新版本。

代码语言:javascript
复制
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

另外,我建议添加这个环境变量,这样它就可以拉出您想要的gradle包装器发行版的url版本。Cordova倾向于添加一个旧版本,除非您添加此环境变量。

CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=http://services.gradle.org/distributions/gradle-2.8-all.zip

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35988903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档