[英]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. 我有一个使用
IplImages
的程序, IplImages
,它一直运行良好。 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: 我现在尝试使用多线程,当我尝试在
MyThread class
(扩展Thread)中使用IplImage class
时,在调试屏幕上显示了此信息:
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.
现在,当我在
MainActivity class
调用该代码时,它可以正常工作,但是当我在MyThread.
调用该代码时,它似乎中断了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 Android没有大多数awt类,它仅具有java.awt.font中的2个类
See the documentation http://developer.android.com/reference/packages.html 请参阅文档http://developer.android.com/reference/packages.html
There are also other pitfalls like no full support of the java.beans package. 还有其他陷阱,例如没有完全支持java.beans包。
I would recommend to set a breakpoint where the BufferedImage is successfully loaded and then analyse the class loader that loaded the BufferedImage. 我建议设置一个在其中成功加载BufferedImage的断点,然后分析加载BufferedImage的类加载器。 Hopefully it is a URLClassLoader and you can find out the resource that provides tha java.awt.ButteredImage.
希望它是一个URLClassLoader,您可以找到提供java.awt.ButteredImage的资源。
Then set an exception breakpoint to ClassNotFoundException and try the code that fails. 然后将异常断点设置为ClassNotFoundException并尝试失败的代码。 Go back in the stacktrace to the place where the class loading got triggered from and also analyse this class loader.
返回堆栈跟踪中触发了类加载的位置,并分析该类加载器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.