2

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!

Danilo Casa
  • 506
  • 1
  • 9
  • 18
Dark Ducke
  • 145
  • 1
  • 3
  • 12

2 Answers2

2

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:


Add a Java Library File (.jar) Using the Project Manager (XE7 Way)

  1. In the Project Manager, extend the Target Platforms node of your project. Within the Target Platforms node, extend the Android node.
  2. Right-click the Libraries node and select Add.

    Project Manager > Android Libraries > Add

  3. 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.

    Project Manager > Android > Libraries

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 deployed classes.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:

  1. Select 'Project > Deployment' to open the Deployment Manager.
  2. Uncheck the checkbox of the default classes.dex file.
  3. Click the Add Files button and add your custom classes.dex file to the list of deployment files.
  4. Change the Remote Path of your new entry to classes\.
  5. Change the Platforms of your new entry to Android only.

Project > Deployment

See Troubleshooting in case if your app does not start after manipulations with the classes.dex file.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
0

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.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259