我主要是一个使用Cordova的混合应用程序开发人员。我遇到了一个有趣的场景,我想我需要创建一个Cordova插件来实现用于iOS和Android available here的原生Garmin SDK。
我已经检查了cordova的插件文档,并完成了它们的示例。Link here。我还回顾了一些关于这个问题的不错的资源,参见Instabug's和来自Modus的一个。
然而,我缺乏足够的知识来理解为什么Garmin SDK中缺少其他教程中包含的一些组件。主要是ConnectIQ.bundle。
我也不确定是什么原因导致了我遇到的错误。我有一种感觉,项目无法找到通过我正在尝试开发的自定义插件实现ConnectIQ.framework的特定文件。
我甚至发现了另一个人的实现,非官方的cordova Connect IQ插件they released last year。在执行时,这是我的错误日志:
2016-12-18 18:35:04.748 appTest[56419:4257397] CDVPlugin class CIQPlugin (pluginName: connectiq) does not exist.
2016-12-18 18:35:04.748 appTest[56419:4257397] [CDVTimer][connectiq] 0.180006ms
2016-12-18 18:35:13.942 appTest[56419:4257397] CDVPlugin class CIQPlugin (pluginName: ConnectIQ) does not exist.
2016-12-18 18:35:13.942 appTest[56419:4257397] ERROR: Plugin 'ConnectIQ' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2016-12-18 18:35:13.942 app Test[56419:4257397] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["INVALID","ConnectIQ","initializeWithUrlScheme",["prefs-123456"]]它包含plugin.xml文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2014 PayPal. All rights reserved. -->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.heavydutydev.cordova.ciq"
version="0.0.1">
<name>Cordova CIQ</name>
<description>This plugin allows basic interactions with the Garmin Connect IQ native interfaces</description>
<keywords>garmin, connect-iq, connect iq</keywords>
<license>NONE</license>
<engines>
<engine name="cordova" version=">=5.0.0" />
</engines>
<!-- ios -->
<platform name="ios">
<js-module src="www/cdv-plugin-connect-iq.js" name="ConnectIQ">
<clobbers target="ConnectIQ" />
</js-module>
<config-file target="config.xml" parent="/*">
<feature name="ConnectIQ">
<param name="ios-package" value="CIQPlugin" onload="true" />
</feature>
</config-file>
<source-file src="src/ios/ConnectIQ.framework" framework="true" />
<!-- <header-file src="src/ios/PayPalMobileCordovaPlugin.h" />
<source-file src="src/ios/PayPalMobileCordovaPlugin.m" />
<header-file src="src/ios/PayPalMobile/PayPalConfiguration.h" />
<header-file src="src/ios/PayPalMobile/PayPalFuturePaymentViewController.h" />
<header-file src="src/ios/PayPalMobile/PayPalMobile.h" />
<header-file src="src/ios/PayPalMobile/PayPalOAuthScopes.h" />
<header-file src="src/ios/PayPalMobile/PayPalPayment.h" />
<header-file src="src/ios/PayPalMobile/PayPalPaymentViewController.h" />
<header-file src="src/ios/PayPalMobile/PayPalProfileSharingViewController.h" />
<source-file src="src/ios/PayPalMobile/libPayPalMobile.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libCardIO.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libopencv_core.a" framework="true" />
<source-file src="src/ios/PayPalMobile/libopencv_imgproc.a" framework="true" />
<framework src="Accelerate.framework" />
<framework src="AudioToolbox.framework" />
<framework src="AVFoundation.framework" />
<framework src="CFNetwork.framework" />
<framework src="CoreGraphics.framework" />
<framework src="CoreLocation.framework" weak="true" />
<framework src="CoreMedia.framework" weak="true" />
<framework src="CoreVideo.framework"/>
<framework src="MessageUI.framework" />
<framework src="OpenGLES.framework" />
<framework src="MobileCoreServices.framework" />
<framework src="Security.framework" />
<framework src="SafariServices.framework"/>
<framework src="SystemConfiguration.framework" />
<framework src="QuartzCore.framework"/>
<framework src="UIKit.framework"/>
<framework src="libc++.dylib" />
<framework src="libPayPalMobile.a" />
<framework src="libCardIO.a" />
<framework src="libopencv_core.a" />
<framework src="libopencv_imgproc.a" /> -->
</platform>
<platform name="android">
<js-module src="www/cdv-plugin-connect-iq.js" name="ConnectIQ">
<clobbers target="ConnectIQ" />
</js-module>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="ConnectIQ">
<param name="android-package" value="com.heavydutydev.cordova.ciq.CIQPlugin" />
</feature>
</config-file>
<source-file src="src/android/com/heavydutydev/cordova/ciq/CIQPlugin.java" target-dir="src/com/heavydutydev/cordova/ciq" />
<source-file src="src/android/com/heavydutydev/cordova/ciq/CIQContext.java" target-dir="src/com/heavydutydev/cordova/ciq" />
<source-file src="src/android/libs/connectiq.jar" target-dir="libs" />
<!--
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
</config-file> -->
<!-- <config-file target="AndroidManifest.xml" parent="/manifest/application">
<service android:name="com.paypal.android.sdk.payments.PayPalService"
android:exported="false" />
<activity android:name="com.paypal.android.sdk.payments.PaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.LoginActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" />
<activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity" />
<activity android:name="com.paypal.android.sdk.payments.PayPalProfileSharingActivity" />
<activity android:name="com.paypal.android.sdk.payments.ProfileSharingConsentActivity" />
<activity
android:name="io.card.payment.CardIOActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" />
</config-file> -->
</platform>
</plugin>基于这些错误和我的研究,我认为plugin.xml和config.xml与我正在尝试实现的SDK没有正确地对齐。如果任何人能提供一些额外的故障排除步骤,以便我可以了解更多关于这个问题,将不胜感激。
发布于 2016-12-21 12:27:36
我已经用ddteeter plugin启动了我自己的插件。
但它将只支持Android操作系统。
据我所知,你在使用ConnectIQСordova插件时遇到了一些错误。
因此,我建议您从头开始执行以下操作:
1)从github下载/克隆ddteeter插件。
2)创建cordova工程。添加Android平台。
3)使用NPM安装plugman工具。
4)在刚刚创建的工程中安装ddteeter插件。
call plugman install --platform android --project platforms\android --plugin some\filesystem\path\to\ddteeter\plugin\root\directory在此之后,您将能够连接到您的设备(或Monkey C应用程序,如果有必要)。
此外,即使是直接消息,你将不得不从Google Play安装Garmin Connect应用程序,否则Android BLE SDK将无法工作。
还要记住,这个插件不包含任何有价值的逻辑。但它允许您枚举成对的设备,以检查所有设备是否正常工作。这个插件公开了可以从你的JavaScript代码中访问的'ConnectIQ‘全局变量。
https://stackoverflow.com/questions/41214117
复制相似问题