ant problem with external jars

edited February 2014 in Android Mode

I have some problems with Processing, Ant and some external jars, I hope you can help me. I am using the template found here: https://github.com/processing/processing-android-library-template

It works fine without changes, I tested on my Android.

The problem arises when I try to include some external jars, in order to use an Android library from within Processing. I'm adding these just above the import processing.core.* line:

import Catalano.Imaging.FastBitmap; import Catalano.Imaging.Filters.BradleyLocalThreshold;

I added the jars in the lib/ dir of the project and while compiling ant spits out these errors:

      [javadoc] Generating Javadoc
      [javadoc] Javadoc execution
      [javadoc] Loading source file C:\Users\antonis\Documents\mixed_eclipse_processing\processing-android-library-template-master\tmp\YourLibrary\src\template\library\HelloLibrary.java...
      [javadoc] Constructing Javadoc information...
      [javadoc] C:\Users\antonis\Documents\mixed_eclipse_processing\processing-android-library-template-master\tmp\YourLibrary\src\template\library\HelloLibrary.java:32: error: package Catalano.Imaging does not exist
      [javadoc] import Catalano.Imaging.FastBitmap;
      [javadoc]                        ^
      [javadoc] C:\Users\antonis\Documents\mixed_eclipse_processing\processing-android-library-template-master\tmp\YourLibrary\src\template\library\HelloLibrary.java:33: error: package Catalano.Imaging.Filters does not exist
      [javadoc] import Catalano.Imaging.Filters.BradleyLocalThreshold;
      [javadoc]                                ^
      [javadoc] Standard Doclet version 1.7.0_21
      [javadoc] Building tree for all the packages and classes...
      [javadoc] javadoc: error - Error - Exception java.lang.ClassNotFoundException thrown while trying to register Taglet ExampleTaglet...
      [javadoc] C:\Users\antonis\Documents\mixed_eclipse_processing\processing-android-library-template-master\tmp\YourLibrary\src\template\library\HelloLibrary.java:57: warning - @example is an unknown tag.
      [javadoc] C:\Users\antonis\Documents\mixed_eclipse_processing\processing-android-library-template-master\tmp\YourLibrary\src\template\library\HelloLibrary.java:78: warning - @example is an unknown tag.

Sometimes the build succeeds (and sometimes it doesn't.. :/) and when I navigate to the output directory, I can see it contains all the necessary jars under the library dir.

But when trying to use it in code, it fails (symbol does not exist).

How can I fix this?

Answers

  • One thing strikes me: usually, package names are all lowercase, so it would be import catalano.imaging.FastBitmap; and import catalano.imaging.filters.BradleyLocalThreshold;

    Now, perhaps that's the library creator going a non-standard way.

  • @PhiLho: Indeed, the Catalano Framework appears to use non-conventional package names (this probably has to do with the .NET origins of the library).

    Try renaming the lib folder to libs.

    In older versions of the ADT, the folder was called lib. However, more recent versions of the ADT (17+) have switched to the libs folder. Any JAR file in the libs folder will automatically get added to the classpath and packaged with the APK file.

    If you use Processing's library distribution system, you may need to keep the libraries in both the libs folder and the lib folder (based on what it says in the template's README...).

  • Thanks for the answers.

    @PhiLho: is there an easy fix?

    @calsign: tried adding a libs folder (while keeping the lib folder), same thing. I'm using the method that is illustrated in https://github.com/processing/processing-android-library-template .

  • Bump.

    Still trying to get this working.. I recompiled the whole Catalano library so that it imports import catalano.imaging.FastBitmap instead of Catalano.Imaging.FastBitmap but it still doesn't work.

    So what I'm trying to do is be able to use Catalano framework (https://code.google.com/p/catalano-framework/) from a Processing sketch.

    Specifically I want to run this simple example from the Catalano framework from Processing: http://pastebin.com/rtZeDB9P (threshold an image and display it)

    You can find it after downloading Catalano 1.2 (All), in Samples\Android\Imaging\BradleyThreshold\src\com\example\bradleythreshold\MainActivity.java

    I'm on Windows 7 64bit.

    I followed the instructions described here: https://github.com/processing/processing-android-library-template

    When trying to run from Processing, I get "cannot find symbol".

    Help?

  • Answer ✓

    I don't understand why you are following the Android Library Template tutorial if you are trying to use an existing library from a Processing sketch. The tutorial is for creating libraries. You are probably being misled by the tutorial...

    If you have a library JAR file, try placing it in your sketch's code folder (within the sketch folder).

  • Thanks calsign, it worked!

Sign In or Register to comment.