我的第一个phonegap app手电筒在cordova构建上失败了

时间:2015-12-23 23:35:37

标签: android cordova

我尽力遵循所有说明。我使用此插件 - https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin

这是我写的完整应用程序 - https://github.com/c0debreaker/flashlight-phonegap

执行cordova build时出现以下错误:

$ cordova build
Running command: /Users/user01/repos/Flash/platforms/android/cordova/build
ANDROID_HOME=/usr/local/bin/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/user01/repos/Flash/platforms/android/gradlew cdvBuildDebug -b /Users/user01/repos/Flash/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
/Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug/xml/config.xml:20: error: Error parsing XML: unbound prefix

:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /usr/local/bin/android-sdk-macosx/build-tools/23.0.2/aapt package -f --no-crunch -I /usr/local/bin/android-sdk-macosx/platforms/android-22/android.jar -M /Users/user01/repos/Flash/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug -A /Users/user01/repos/Flash/platforms/android/build/intermediates/assets/debug -m -J /Users/user01/repos/Flash/platforms/android/build/generated/source/r/debug -F /Users/user01/repos/Flash/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package io.cordova.hellocordova -0 apk --output-text-symbols /Users/user01/repos/Flash/platforms/android/build/intermediates/symbols/debug
  Error Code:
    1
  Output:
    /Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug/xml/config.xml:20: error: Error parsing XML: unbound prefix



* 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: 1.917 secs

/Users/user01/repos/Flash/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /Users/user01/repos/Flash/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/user01/repos/Flash/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/user01/repos/Flash/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/user01/repos/Flash/platforms/android/cordova/build: Command failed with exit code 1

1 个答案:

答案 0 :(得分:1)

错误位于config.xml,您没有gap的名称空间导入: enter image description here

你可以做两件事:

  1. 将此命名空间添加到widget代码:enter image description here

  2. 或者删除gap中的gap:plugin前缀,因为现在您可以直接在phonegap版本上使用plugin