Phonegap构建错误(phonegap build android命令)

时间:2015-07-08 18:30:54

标签: android cordova hybrid-mobile-app

我想安装phonegap,我在构建时遇到一些错误。 (我已经安装了jdk,git,node.js,apache-ant,android studion,sdk和sdk manager以及设置环境变量)

:processDebugManifest
C:\my_first_app\platforms\android\AndroidManifest.xml:15:5 Error:
        uses-sdk:minSdkVersion 7 cannot be smaller than version 10 declared in l
ibrary C:\my_first_app\platforms\android\build\intermediates\exploded-aar\androi
d\CordovaLib\unspecified\debug\AndroidManifest.xml
        Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usag
e


 FAILED



FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':processDebugManifest'.

>
Manifest merger failed : uses-sdk:minSdkVersion 7 cannot be smaller than version
 10 declared in library C:\my_first_app\platforms\android\build\intermediates\ex
ploded-aar\android\CordovaLib\unspecified\debug\AndroidManifest.xml
        Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usag
e



* Try:

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



BUILD FAILED




Total time: 47.884 secs


C:\my_first_app\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\my_first_app\platforms\androi
d\gradlew cdvBuildDebug -b C:\my_first_app\platforms\android\build.gradle -Dorg.
gradle.daemon=true"

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
    at ChildProcess.whenDone (C:\Users\Cebit\AppData\Roaming\npm\node_modules\ph
onegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:1
34:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

在系统属性中 - >环境变量:

path变量是:

C:\Program Files (x86)\Silverfrost\FTN95;C:\Program Files (x86)\ActiveState Komodo IDE 8\;%systemroot%\system32\windowspowershell\v1.0\;%systemroot%\system32\wbem;%systemroot%\system32;c:\progra~2\egcs\bin;c:\program files (x86)\microsoft sql server\100\tools\binn\;c:\program files\microsoft sql server\100\tools\binn\;c:\program files\microsoft sql server\100\dts\binn\;%systemroot%;%QUARTUS_ROOTDIR%\bin;C:\Program Files (x86)\MATLAB\R2010a\runtime\win32;C:\Program Files (x86)\MATLAB\R2010a\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

2 个答案:

答案 0 :(得分:4)

最后我找到了答案。

首先,在新版本的phonegap中提到here时出现问题。 (检查接受的答案)

www\config.xml文件中

然后,将其替换为:

<preference name="android-minSdkVersion" value="7" />

有了这个:

<preference name="android-minSdkVersion" value="10" />

答案 1 :(得分:2)

@vahid 您的错误日志表明您正在使用uses-sdk:minSdkVersion = 7 改为10或更好,我建议14

uses-sdk:minSdkVersion=10

它会将您的Android SDK级别设置为10(Gingerbread)。

什么是 use-sdk:minSdkVersio n?请遵循此link