3

我正在尝试在 phonegap3 项目中使用https://github.com/Pyo25/Phonegap-SMS-reception-plugin,当我尝试编译时出现此错误:

$ phonegap local run android
[phonegap] compiling Android...
   [error] An error occurred while building the android project. Warning : [ --debug | --release | --nobuild ] not specified, defaulting to --debug
Cleaning project...
Buildfile: /home/celcom/tmp/t1/my-app/platforms/android/build.xml

-check-env:
 [checkenv] Android SDK Tools Revision 22.0.4
 [checkenv] Installed at /home/celcom/programas/android-sdks

-setup:
     [echo] Project Name: HelloWorld
  [gettype] Project Type: Application

-pre-clean:

clean:
   [delete] Deleting directory /home/celcom/tmp/t1/my-app/platforms/android/bin
   [delete] Deleting directory /home/celcom/tmp/t1/my-app/platforms/android/gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
   [subant] No sub-builds to iterate on

BUILD SUCCESSFUL
Total time: 0 seconds
Buildfile: /home/celcom/tmp/t1/my-app/platforms/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 22.0.4
 [checkenv] Installed at /home/celcom/programas/android-sdks

-setup:
     [echo] Project Name: HelloWorld
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 18.0.0
     [echo] Resolving Build Target for HelloWorld...
[gettarget] Project Target:   Android 4.2.2
[gettarget] API level:        17
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /home/celcom/tmp/t1/my-app/platforms/android/bin
    [mkdir] Created dir: /home/celcom/tmp/t1/my-app/platforms/android/bin/res
    [mkdir] Created dir: /home/celcom/tmp/t1/my-app/platforms/android/gen
    [mkdir] Created dir: /home/celcom/tmp/t1/my-app/platforms/android/bin/classes
    [mkdir] Created dir: /home/celcom/tmp/t1/my-app/platforms/android/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for HelloWorld...
[dependency] Library dependencies:
[dependency] No Libraries
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] No libraries. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 5 source files to /home/celcom/tmp/t1/my-app/platforms/android/bin/classes
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:24: package org.apache.cordova.api does not exist
    [javac] import org.apache.cordova.api.CallbackContext;
    [javac]                              ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:25: package org.apache.cordova.api does not exist
    [javac] import org.apache.cordova.api.CordovaPlugin;
    [javac]                              ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:26: package org.apache.cordova.api does not exist
    [javac] import org.apache.cordova.api.PluginResult;
    [javac]                              ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:34: cannot find symbol
    [javac] symbol: class CordovaPlugin
    [javac] public class SmsInboxPlugin extends CordovaPlugin {
    [javac]                                     ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:39: cannot find symbol
    [javac] symbol  : class CallbackContext
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]     private CallbackContext callback_receive;
    [javac]             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:25: package org.apache.cordova.api does not exist
    [javac] import org.apache.cordova.api.CallbackContext;
    [javac]                              ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:26: package org.apache.cordova.api does not exist
    [javac] import org.apache.cordova.api.PluginResult;
    [javac]                              ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:49: cannot find symbol
    [javac] symbol  : class CallbackContext
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             final CallbackContext callbackContext) throws JSONException {
    [javac]                   ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:38: cannot find symbol
    [javac] symbol  : class CallbackContext
    [javac] location: class org.apache.cordova.plugin.SmsReceiver
    [javac]     private CallbackContext callback_receive;
    [javac]             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:77: cannot find symbol
    [javac] symbol  : class CallbackContext
    [javac] location: class org.apache.cordova.plugin.SmsReceiver
    [javac]     public void startReceiving(CallbackContext ctx) {
    [javac]                                ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:53: cannot find symbol
    [javac] symbol  : variable cordova
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             Activity ctx = this.cordova.getActivity();
    [javac]                                ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:55: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
    [javac]                                                      ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:55: package PluginResult does not exist
    [javac]                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
    [javac]                                                                               ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:57: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, false));
    [javac]                                                      ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:57: package PluginResult does not exist
    [javac]                 callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, false));
    [javac]                                                                               ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:67: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]                 PluginResult pluginResult = new PluginResult(
    [javac]                 ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:67: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]                 PluginResult pluginResult = new PluginResult(
    [javac]                                                 ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:68: package PluginResult does not exist
    [javac]                         PluginResult.Status.NO_RESULT);
    [javac]                                     ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:81: cannot find symbol
    [javac] symbol  : variable cordova
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]                 this.cordova.getActivity().registerReceiver(this.smsReceiver, fp);
    [javac]                     ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:86: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             PluginResult pluginResult = new PluginResult(
    [javac]             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:86: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             PluginResult pluginResult = new PluginResult(
    [javac]                                             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:87: package PluginResult does not exist
    [javac]                     PluginResult.Status.NO_RESULT);
    [javac]                                 ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:103: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             PluginResult pluginResult = new PluginResult(
    [javac]             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:103: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             PluginResult pluginResult = new PluginResult(
    [javac]                                             ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:104: package PluginResult does not exist
    [javac]                     PluginResult.Status.NO_RESULT);
    [javac]                                 ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:109: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsInboxPlugin
    [javac]             pluginResult = new PluginResult(
    [javac]                                ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:110: package PluginResult does not exist
    [javac]                     PluginResult.Status.OK);
    [javac]                                 ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsInboxPlugin.java:47: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:60: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsReceiver
    [javac]                     PluginResult result = new PluginResult(PluginResult.Status.OK, formattedMsg);
    [javac]                     ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:60: cannot find symbol
    [javac] symbol  : class PluginResult
    [javac] location: class org.apache.cordova.plugin.SmsReceiver
    [javac]                     PluginResult result = new PluginResult(PluginResult.Status.OK, formattedMsg);
    [javac]                                               ^
    [javac] /home/celcom/tmp/t1/my-app/platforms/android/src/org/apache/cordova/plugin/SmsReceiver.java:60: package PluginResult does not exist
    [javac]                     PluginResult result = new PluginResult(PluginResult.Status.OK, formattedMsg);
    [javac]                                                                        ^
    [javac] 31 errors

BUILD FAILED
/home/celcom/programas/android-sdks/tools/ant/build.xml:713: The following error occurred while executing this line:
/home/celcom/programas/android-sdks/tools/ant/build.xml:727: Compile failed; see the compiler error output for details.

Total time: 1 second

我可以在哪里配置JAVAC使用phonegap3项目中的cordova库?

谢谢 :)

4

1 回答 1

6

似乎 org.apache.cordova.api.* 在版本 3+ 中已更改为 org.apache.cordova.*

所以改变 org.apache.cordova.api.CallbackContext; 到 org.apache.cordova.CallbackContext;

你应该没事

于 2013-08-02T15:43:49.540 回答