Phonegap - Android 构建错误

Phonegap - Android Build Error

这是我所做的。

在命令行中:

$ phonegap -v
5.3.6

$ phonegap create myfirstproject
Creating a new cordova project.
Downloading hello-world-template libarary for www...
Download Complete

$ cd myfirstproject

$ phonegap remote login
[phonegap] Phonegap/Build Login
[phonegap] Sign up at build.app.com
 [warning] Github accounts are unsupported
  [prompt] enter username: myusername
  [prompt] enter password: **********
[phonegap] logged in as myusername

$ phonegap remote run android
[phonegap] compressing the app
[phonegap] uploading the app
[phonegap] building the app
   [error] error occured while building the android app

然后我去 https://build.phonegap.com 并登录。我转到我的应用程序,然后单击 "android" 并将我重定向到我的项目构建。我点击 "Log" 按钮,我得到了这个:

-compile:
    [javac] Compiling 43 source files to /project/bin/classes
    [javac] /project/src/org/apache/cordova/filetransfer/FileTransfer.java:692: error: cannot find symbol
    [javac]         if (!isLocalTransfer && !Config.isUrlWhiteListed(source)) {
    [javac]                                        ^
    [javac]   symbol:   method isUrlWhiteListed(String)
    [javac]   location: class Config
    [javac] /project/src/org/apache/cordova/inappbrowser/InAppBrowser.java:122: error: cannot find symbol
    [javac]                                 || Config.isUrlWhiteListed(url)) {
    [javac]                                          ^
    [javac]   symbol:   method isUrlWhiteListed(String)
    [javac]   location: class Config
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 2 errors

BUILD FAILED
/android-sdk/tools/ant/build.xml:716: The following error occurred while executing this line:
/android-sdk/tools/ant/build.xml:730: Compile failed; see the compiler error output for details.

Total time: 6 seconds

/project/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args: debug,-f,/project/build.xml

有人知道这个错误吗?我们如何解决这个问题?

我刚找到答案!

我得到这些错误的原因是 phonegap/cordova 将他们的插件源移动到 NPM

这是我解决问题的方法。

我更新了 config.xml 中的所有“插件名称及其来源”,如:

来自这个:

<gap:plugin name="org.apache.cordova.camera" />

对此:

<gap:plugin name="cordova-plugin-camera" source="npm" />

现在,我成功构建了应用程序。 =)

参考: