2016-03-14 22 views
1

我有一個錯誤與MobileFirst基金會7.1,當我想我的設備與指揮上運行我的應用程序:MFP科爾多瓦運行-p安卓錯誤gradle這個-p的Android

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有什麼問題嗎?

回答

0

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

buildscript { 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 
    } 
} 

然後進入平臺/安卓/ gradle產出/包裝/ gradle-wrapper.properties並確保distributionUrl值使用最新的。

distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 

另外我會建議添加這個環境變量,以便它將拉你想要的gradle包裝分發url版本。科爾多瓦傾向於添加一箇舊版本,除非你添加這個環境變量。

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

+0

所以我在build.gralde但不是在gradle-wrapper.properties好值,其中我有這個代碼: 'distributionBase = GRADLE_USER_HOME distributionPath =包裝紙/ dists中 zipStoreBase = GRADLE_USER_HOME zipStorePath =包裝紙/ dists中 distributionUrl = HTTP \://services.gradle.org/distributions/gradle-1.12-all.zip ' 即使添加了這個環境變量:CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL = http://services.gradle.org/distributions/gradle-2.8-all.zip –

+0

手動更改'distributionUrl = http \://services.gradle.org/distributions/ gradle-1.12-all.zip「添加到gradle-wrapper.properties中的正確版本以達到正確的值。 此外,通過您的項目的父目錄,並刪除任何build.gradle&gradle文件夾(內置gradle包裝文件)。有時這些會生成。 ex。 C:/ User/workspace/myproject /, gradle文件可能在用戶目錄或工作區目錄中生成。你需要刪除這些。 – ktop