MacOS:cordova 平台添加 android

MacOS: cordova platform add android

我使用 Yosemite,但无法使用 cordova phonegap 构建 android 应用程序

我的“.bash_profile”文件

$ cat ~/.bash_profile 
export ANDROID_HOME=/Users/huy/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANT_HOME=/usr/local/apache-ant-1.9.4

Cordova、nodejs、ant版本

$ ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
$ node --version
v0.10.35
$ cordova -v
4.1.2

我的Android个SDK组件

(抱歉我无法附上照片)

Android SDK Tools           24.0.2
Android SDK Platform-tools  21
Android 4.4.2 (API 19)

我在“/Users/huy/Documents/zPhoneGap/Helloworld”有一个 phonegap 项目

然后将 android 平台添加到此 phonegap 项目

$ cd /Users/huy/Documents/zPhoneGap/Helloworld 
$ cordova platform ls
Installed platforms: ios 3.7.0
Available platforms: amazon-fireos, android, blackberry10, browser, firefoxos
$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: io.cordova.hellocordova
    Name: HelloCordova
    Android target: android-19
Copying template files...
Project successfully created.
Installing "org.apache.cordova.battery-status" for android
Installing "org.apache.cordova.console" for android
$ cordova platform ls
Installed platforms: android 3.6.4, ios 3.7.0
Available platforms: amazon-fireos, blackberry10, browser, firefoxos

之后,我只是为 android

构建
$ cordova build android

但结果是"BUILD FAILED"

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] /Users/huy/Documents/zPhoneGap/Helloworld/platforms/android/res/xml/config.xml:34: error: Error parsing XML: unbound prefix
     [aapt] 


BUILD FAILED
/Users/huy/Library/Android/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/Users/huy/Library/Android/sdk/tools/ant/build.xml:698: null returned: 1

Total time: 5 seconds

/Users/huy/Documents/zPhoneGap/Helloworld/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args: debug,-f,/Users/huy/Documents/zPhoneGap/Helloworld/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/huy/Documents/zPhoneGap/Helloworld/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)

我不知道要解决这个问题, google 周围但没有任何效果。

Phonegap/Cordova build android node_modules/q/q.js throw e;

Cordova android build error

PhoneGap/Cordova Android Development

任何人都知道为什么会发生这种情况以及如何解决它?非常感谢!

我有同样的问题,但是当我更改 <widget id="config.xml"> 处的值时它起作用了。