I would like to use the lib https://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/ with delphi XE5, but the lib and. Jar and. So, You can use it with delphi XE5, how do? I need to read the barcode on my webcam!
-
1http://www.pclviewer.com/android/ – Ken White Nov 03 '13 at 16:11
2 Answers
Take a look at Using a Custom Set of Java Libraries In Your RAD Studio Android Apps. I understand that there was a lack of information on this topic in 2013, but now it is described in the documentation.
There are two different approaches that you can follow to add your Java libraries to your application for Android:
- Use the Project Manager to add your Java libraries to your application. This is the simplest approach, you only need a couple of clicks. This approach should work for most people.
- Create and deploy a classes.dex file manually. This approach allows you not only to add libraries to your application, but also to modify the built-in RAD Studio Java libraries for Android, or remove those that you do not need.
Add a Java Library File (.jar) Using the Project Manager (XE7 Way)
- In the Project Manager, extend the Target Platforms node of your project. Within the Target Platforms node, extend the Android node.
Right-click the Libraries node and select Add.
In the dialog box that opens, select the
.jar
file that you want to add to your application for Android, and select Open.Now the Project Manager displays your custom Java library under the Libraries node.
You can now use your Java library.
Remember to create a native bridge file for your Java library if you do not have one yet.
Create and deploy a classes.dex file from JARs manually (Old Way)
Once you have determined which JAR files your Android applications need, you can create a classes.dex
file from them.
To create a classes.dex
file, you need to use the command-line tool dx
. You can find this command-line tool at C:\Path\To\Embarcadero\Studio\Version\PlatformSDK\adt-bundle-windows-x86-20131030\sdk
.
Run dx
with the --dex
parameter, the --output
parameter with the output path of the classes.dex
file as its argument, and a space-separated list of paths to the JAR files that you want to include in the generated classes.dex
file. For example:
dx --dex --output="classes.dex" "C:\Path\To\Library1.jar" "C:\Path\To\Library2.jar"
Note: You should create both a debug and a release version of your
classes.dex
file. The RAD Studio debugging features are only available if the deployedclasses.dex
file contains the debug versions of the included RAD Studio built-in Java libraries.
Deploying the `classes.dex` File
Warning: Follow these steps carefully. Android applications must always include a valid
classes.dex
file.
To configure your Android application to be deployed with your custom classes.dex
file:
- Select 'Project > Deployment' to open the Deployment Manager.
- Uncheck the checkbox of the default
classes.dex
file. - Click the Add Files button and add your custom
classes.dex
file to the list of deployment files. - Change the Remote Path of your new entry to
classes\
. - Change the Platforms of your new entry to Android only.
See Troubleshooting in case if your app does not start after manipulations with the classes.dex
file.

- 35,493
- 19
- 190
- 259
There is a library for Delphi XE7 for reading/scanning barcodes. This library was released in 2015 and is actively supported.
ZXing.Delphi - barcode scanning object Pascal library for Delphi XE7-Berlin.
So now if you want to read the barcode on a webcam, you don't need to tinker with .jar / .so files.

- 35,493
- 19
- 190
- 259