问题
I'm followed this IBM Worklight article instructions - link.
On Eclipse - when I try to run BarcodeScannerSampleBarcodeScannerSampleAppAndroid -
I get message box with title - "Android Launch"
, that says:"Your projects contains error".
At Markers window I get this Error:
The container 'Android Dependencies' references non existing library 'D:\Users\MyUser\workspaceNew\CaptureActivity\bin\captureactivity.jar' BarcodeScannerSampleBarcodeScannerSampleAppAndroid Build path Build Path Problem
Directory - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\"
doesn't contains "captureactivity.jar"
file.
Any idea? Thanks!
回答1:
Make sure you follow the instructions in the blog post to the letter.
It sounds like you did not follow the last step, which says to:
- Right-click the generated Android project and select Properties
- In the Android entry from the left pane, click on Add and select CaptureActivity
Fuller steps:
- Download & extract the zip from GitHub: https://github.com/phonegap-build/BarcodeScanner/archive/master.zip
- In Eclipse, File > Import > Android > Existing Android Code Into Workspace
- Click on Browse and then find the extracted folder
- Navigate in it into ../BarcodeScanner-master/src/android/LibraryProject and click Finish
Then you need to continue with creating the Worklight project. It's two different projects.
- In your Worklight project, you need to navigate to your-project\apps\your-app\android\native
- There you need to right-click on the src folder and select Import... > General > File System
- Navigate to the same extracted folder, into ../BarcodeScanner-master/src/android and click Next
- Tick the checkbox next to the android option that will appear after step 3
Next you need to configure AndroidManifest.xml and config.xml in the same location (your-app\android\native).
In both the CaptureActivity AndroidManifest.xml and the Worklight project AndroidManifest.xml I've set the minSdkVersion to 19, which I have installed.
Now,
- Once you're done with that, build the project.
- Right-click on the generated Android project > Properties > Android
- Click the Add... button and select the CaptureActivity library
Make sure to not select the "Is library" checkbox.
回答2:
Looks like you missed one step.
- 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.
And make sure you configured the config.xml and AndroidManifest.xml properly.
You can find the file here: https://github.com/phonegap-build/BarcodeScanner/
- Click on "Clone in Desktop".
- Extract the zip file.
- Import the resources as following. https://www.ibm.com/developerworks/community/blogs/WASFAQs/resource/BLOGS_UPLOADED_IMAGES/scan_importplugin.jpg
回答3:
Yaniv thanks.
The problem was in CaptureActivity library.
After importing "Existing Android Code Into Workspace", I should BUILD the project library.
Then it create a directory - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\"
with "captureactivity.jar"
file in it.
Thanks!
来源:https://stackoverflow.com/questions/27633094/worklight-6-1-barcode-scanner-plugin