0

I am working in an Android project recently. Our project uses a computer vision library called boofcv:

http://boofcv.org/index.php?title=Main_Page

After importing the library source code into our project, I found that Android Studio cannot revolve symbols from sun.awt.image.* and java.awt.color.ColorSpace.

package boofcv.core.image;

import boofcv.struct.image.*;
import sun.awt.image.ByteInterleavedRaster;
import sun.awt.image.IntegerInterleavedRaster;
import sun.awt.image.ShortInterleavedRaster;

import javax.swing.*;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
import java.lang.reflect.Array;

/**
 * Functions for converting to and from {@link BufferedImage}.
 *
 * @author Peter Abeles
 */
public class ConvertBufferedImage {
......

But then I wrote a very simple test program and found that my jdk did contain those classes. my program:

import sun.awt.image.ByteInterleavedRaster;
import sun.awt.image.IntegerInterleavedRaster;
import sun.awt.image.ShortInterleavedRaster;

import javax.swing.*;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;

class test{
    public static void main(String[] args) {
        ByteInterleavedRaster b;
        IntegerInterleavedRaster i;
        ShortInterleavedRaster s;
        ColorSpace c;

        System.out.println("testing");
    }
}

Did I miss some configuration or it is just the issue of Android Studio?

Any help is greatly appreciated.

Pan Long
  • 1,024
  • 1
  • 9
  • 16

1 Answers1

1

Don't use the visualization package for anything on Android. It's based off on swing which isn't supported on Android. Use the android package in integration. It has similar functions for visualizing data.

https://github.com/lessthanoptimal/BoofAndroidDemo

that might be useful for you.

lessthanoptimal
  • 2,722
  • 2
  • 23
  • 25
  • Thanks for your help :) I have tried the demo ;D. As I need to use source code instead of jar, do I have to find the corresponding android packages and modify it manually? – Pan Long Jun 27 '14 at 03:52
  • I haven't used android studio yet, but it is gradle based. BoofCV is on Maven central so you can import the jars from there. You can also use the pre-compiled jars and reference them locally using gradle. This should be easier than trying to import the whole code base into your project. – lessthanoptimal Jun 27 '14 at 05:08