如何使用本机实现的android cordova插件与流星应用程序

时间:2015-05-13 07:10:44

标签: android cordova meteor

我正在使用cordova集成进行流星应用。在这个应用程序内我使用html5画布,非常慢在Android设备上运行。我知道FastCanvas phonegap插件应该解决这个问题。但是我在使用它时遇到了一些问题:

我包含这样的FastCanvas插件:Cordova.depends({ 'com.adobe.plugins.FastCanvas': 'https://github.com/phonegap/phonegap-plugin-fast-canvas/tarball/2a91875b96485d35db189b80d105e5c572cfa0f4' });

当我尝试在Android上运行项目时我得到了......(对不起硬度=)):

Error while running for mobile platforms: Error running /Users/nazar/.meteor/packages/meteor-tool/.1.0.40.8pvag7++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/cordova-scripts/cordova.sh

BUILD FAILED
/Users/nazar/.meteor/android_bundle/android-sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/nazar/.meteor/android_bundle/android-sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 6 seconds
Error code 1 for command: ant with args: debug,-f,/Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone
(/Users/nazar/.meteor/packages/meteor-tool/.1.0.40.8pvag7++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/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:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)


Running command: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/cordova/build 
Buildfile: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at /Users/nazar/.meteor/android_bundle/android-sdk

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

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.0.0
[echo] Resolving Build Target for Lksapptmp...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/res
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/rsObj
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/rsLibs
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-gen
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/classes
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for Lksapptmp...
[dependency] Library dependencies:
[dependency] 
[dependency] ------------------
[dependency] Ordered libraries:
[dependency] 
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...

nodeps:

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at /Users/nazar/.meteor/android_bundle/android-sdk

-setup:
[echo] Project Name: CordovaLib
[gettype] Project Type: Android Library

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.0.0
[echo] Resolving Build Target for CordovaLib...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/res
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/libs
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/res
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/rsObj
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/rsLibs
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-gen
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes
[mkdir] Created dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for CordovaLib...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------

-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...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 90 source files to /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 warnings
[echo] Creating library output jar file...
[jar] Building jar: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes.jar

-post-compile:

-obfuscate:

-dex:
[echo] Library project: do not convert bytecode...

-crunch:
[crunch] Crunching PNG Files in source dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/res
[crunch] To destination dir: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/res
[crunch] Crunched 0 PNG files to update cache

-package-resources:
[echo] Library project: do not package resources...

-package:
[echo] Library project: do not package apk...

-post-package:

-do-debug:
[echo] Library project: do not create apk...
[propertyfile] Creating new property file: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop

-post-build:

debug:

-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...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:
[echo] Set jars path to: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes.jar

-compile:
[javac] Compiling 41 source files to /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/ant-build/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:19: error: package org.apache.cordova.api does not exist
[javac] import org.apache.cordova.api.CordovaInterface;
[javac]                              ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:20: error: package org.apache.cordova.api does not exist
[javac] import org.apache.cordova.api.CordovaPlugin;
[javac]                              ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:21: error: package org.apache.cordova.api does not exist
[javac] import org.apache.cordova.api.CallbackContext;
[javac]                              ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:22: error: package org.apache.cordova.api does not exist
[javac] import org.apache.cordova.api.PluginResult;
[javac]                              ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:38: error: cannot find symbol
[javac] public class FastCanvas extends CordovaPlugin {
[javac]                                 ^
[javac]   symbol: class CordovaPlugin
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvasMessage.java:19: error: package org.apache.cordova.api does not exist
[javac] import org.apache.cordova.api.CallbackContext;
[javac]                              ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:48: error: cannot find symbol
[javac]     public void initialize(CordovaInterface cordova, CordovaWebView webView) {
[javac]                            ^
[javac]   symbol:   class CordovaInterface
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:72: error: cannot find symbol
[javac]     public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
[javac]                                                           ^
[javac]   symbol:   class CallbackContext
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvasMessage.java:42: error: cannot find symbol
[javac]     public CallbackContext callbackContext;
[javac]            ^
[javac]   symbol:   class CallbackContext
[javac]   location: class FastCanvasMessage
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:47: error: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:50: error: cannot find symbol
[javac]         super.initialize(cordova, webView);
[javac]         ^
[javac]   symbol:   variable super
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:59: error: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:71: error: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:130: error: cannot find symbol
[javac]                         PluginResult result = new PluginResult(PluginResult.Status.ERROR, "Could not create directory");
[javac]                         ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:130: error: cannot find symbol
[javac]                         PluginResult result = new PluginResult(PluginResult.Status.ERROR, "Could not create directory");
[javac]                                                   ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:130: error: package PluginResult does not exist
[javac]                         PluginResult result = new PluginResult(PluginResult.Status.ERROR, "Could not create directory");
[javac]                                                                            ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:154: error: cannot find symbol
[javac]             PluginResult result = new PluginResult(PluginResult.Status.OK, true);
[javac]             ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:154: error: cannot find symbol
[javac]             PluginResult result = new PluginResult(PluginResult.Status.OK, true);
[javac]                                       ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:154: error: package PluginResult does not exist
[javac]             PluginResult result = new PluginResult(PluginResult.Status.OK, true);
[javac]                                                                ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:198: error: cannot find symbol
[javac]         PluginResult res;
[javac]         ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:201: error: cannot find symbol
[javac]              res = new PluginResult(PluginResult.Status.ERROR,result);
[javac]                        ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:201: error: package PluginResult does not exist
[javac]              res = new PluginResult(PluginResult.Status.ERROR,result);
[javac]                                                 ^
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:203: error: cannot find symbol
[javac]              res = new PluginResult(PluginResult.Status.OK,result);
[javac]                        ^
[javac]   symbol:   class PluginResult
[javac]   location: class FastCanvas
[javac] /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/com/adobe/plugins/FastCanvas.java:203: error: package PluginResult does not exist
[javac]              res = new PluginResult(PluginResult.Status.OK,result);
[javac]                                                 ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /Users/nazar/jss/lksapp/.meteor/local/cordova-build/platforms/android/src/org/apache/cordova/file/ContentFilesystem.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 24 errors
[javac] 3 warnings

2 个答案:

答案 0 :(得分:0)

使用Cordova.depends(),您实际上告诉Meteor 依赖于Cordova插件。但它没有将cordova插件添加到Meteor项目中。

要将Cordova插件添加到项目中,您需要运行以下命令:

meteor add cordova com.adobe.plugins.FastCanvas@v.v.v

其中v.v.v是插件版本。如果它不是在官方pugins目录(http://plugins.cordova.io/)中注册的包,则这将不起作用,您必须向Meteor提供带有版本的存储库的链接(假设存储库具有semver标记)或链接到上次提交的tarball,如下所示:

meteor add cordova com.adobe.plugins.FastCanvas@https://github.com/phonegap/phonegap-plugin-fast-canvas/tarball/2a91875b96485d35db189b80d105e5c572cfa0f4

答案 1 :(得分:0)

这是插件的错。 它使用了一些不适用于phonegap 3.0 +的旧命名

使用我的前叉,因为它已修复 https://github.com/Davidx7/phonegap-plugin-fast-canvas