简体   繁体   中英

ClassNotFoundException for java.awt.image.BufferedImage on Android

I'm getting the title error in my program, and am a bit confused as to why. I have a program that uses IplImages , and up until now it has been working fine. I'm trying to use multithreading now though, and when I try to use the IplImage class in my MyThread class (which extends Thread), I'm getting this on the debug screen: 在此处输入图片说明

The code I'm using is:

IplImage imageToProcess = cvLoadImage(fileLocation);

Now, that code works just fine when I'm calling it in the MainActivity class , but seems to break when I call it in MyThread.

Anyone have any idea what I'm doing wrong?

Android does not have most of the awt classes it only has 2 classes from java.awt.font

See the documentation http://developer.android.com/reference/packages.html

There are also other pitfalls like no full support of the java.beans package.

I would recommend to set a breakpoint where the BufferedImage is successfully loaded and then analyse the class loader that loaded the BufferedImage. Hopefully it is a URLClassLoader and you can find out the resource that provides tha java.awt.ButteredImage.

Then set an exception breakpoint to ClassNotFoundException and try the code that fails. Go back in the stacktrace to the place where the class loading got triggered from and also analyse this class loader.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM