【问题标题】:Worklight 6.1 - Barcode Scanner PluginWorklight 6.1 - 条码扫描器插件
【发布时间】:2014-12-24 07:20:48
【问题描述】:

我遵循了这篇 IBM Worklight 文章说明 - link.

在 Eclipse 上 - 当我尝试运行 BarcodeScannerSampleBarcodeScannerSampleAppAndroid - 我收到带有标题的消息框 - "Android Launch",上面写着:"Your projects contains error".

在标记窗口我得到这个错误:

容器“Android Dependencies”引用了不存在的库
'D:\Users\MyUser\workspaceNew\CaptureActivity\bin\captureactivity.jar'
BarcodeScannerSampleBarcodeScannerSampleAppAndroid
构建路径
构建路径问题

目录 - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\" 不包含 "captureactivity.jar" 文件。

有什么想法吗? 谢谢!

【问题讨论】:

  • 除了“修复项目配置以便找到库”之外,您还期望什么答案。

标签: android cordova ibm-mobilefirst phonegap-plugins barcode-scanner


【解决方案1】:

请务必按照博文中的说明进行操作。
听起来你没有遵循最后一步,它说:

  1. 右键点击生成的Android项目,选择属性
  2. 在左侧窗格的 Android 条目中,单击添加并选择 CaptureActivity

更完整的步骤:

  1. 从 GitHub 下载并解压缩 zip:https://github.com/phonegap-build/BarcodeScanner/archive/master.zip
  2. 在 Eclipse 中,文件 > 导入 > Android > 现有 Android 代码到工作区
  3. 点击浏览,然后找到解压的文件夹
  4. 在其中导航到 ../BarcodeScanner-master/src/android/LibraryProject 并点击完成

然后您需要继续创建 Worklight 项目。这是两个不同的项目。

  1. 在您的 Worklight 项目中,您需要导航到 your-project\apps\your-app\android\native
  2. 您需要在此处右键单击 src 文件夹并选择 Import... > General > File System
  3. 导航到相同的提取文件夹,进入 ../BarcodeScanner-master/src/android 并单击下一步
  4. 勾选第 3 步后将出现的 android 选项旁边的复选框

接下来需要在同一个位置(your-app\android\native)配置AndroidManifest.xml和config.xml。

在 CaptureActivity AndroidManifest.xml 和 Worklight 项目 AndroidManifest.xml 中,我已将 minSdkVersion 设置为 19,并已安装。

现在,

  1. 完成后,构建项目。
  2. 右键点击生成的Android项目>属性>Android
  3. 单击添加...按钮并选择 CaptureActivity 库

确保不选择“是库”复选框。

【讨论】:

  • 然后提供您的项目。无论哪种方式,博文中的说明都是有效的。
  • Idan,谢谢,但我已经做到了。也许我应该之前运行 CaptureActivity 项目?当我尝试时,我收到以下消息:无法启动 Android 库项目
  • 不,没有理由启动它。它应该包含在内,而不是单独运行。你配置错误。重新开始。
  • Idan,我重新开始这个项目。我无法获得此类 - “您应该能够看到 com.phonegap.plugins.barcodescanner.BarcodeScanner.java 文件已导入到 src 文件夹中”。我进入文件夹。 com\phonegap... 应该是问题所在?
  • 用更完整的步骤更新了答案。
【解决方案2】:

看起来你错过了一步。

- First we need to import the Java facade to the plugin. This is the code that implements the 
  mandatory CordovaPlugin class and the exec() method. In the Worklight project, go to the 
  location for the Java code
  BarcodeScannerSample/apps/BarcodeScannerSampleApp/android/native/src 
- Right-click on the src folder and select Import...> File System
- Select the directory
  <GIT CLONE FOLDER>/BarcodeScanner/src/android 
  Select File > Import, of type File System, the contents of the com folder from the same 
  source folder
  <GIT CLONE FOLDER>/BarcodeScanner/src/android 
  You should be able see that the com.phonegap.plugins.barcodescanner.BarcodeScanner.java 
  file has beenimported into the src folder.

并确保您正确配置了 config.xml 和 AndroidManifest.xml。

您可以在此处找到该文件:https://github.com/phonegap-build/BarcodeScanner/

【讨论】:

    【解决方案3】:

    Yaniv 谢谢。

    问题出在 CaptureActivity 库中。
    “现有 Android 代码导入工作区” 后,我应该BUILD 项目库。
    然后它创建一个目录 - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\",其中包含 "captureactivity.jar" 文件。

    谢谢!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-13
      相关资源
      最近更新 更多