Eclipse: java.lang.NoClassDefFoundError for JDK classes in an Android project

末鹿安然 提交于 2019-12-03 16:38:42

So what do I have to do to make this single line of code run in an android application?

The short answer is: nothing, because you can't do anything about it. The whole java.awt.* framework isn't part of the Android SDK, including BufferedImage, and hence not supported by the emulator or physical devices. Android has its own implementation for loading and rendering graphics.

Without knowing what you need BufferedImage for, it's hard to say what alternative you should be considering. Most likely you're trying to do some sort of image manipulation that involves getting access to the individual pixels of an image? If that's the case, have a look at the Bitmap and BitmapFactory classes.

It all boils down to Java SDK != Android SDK. Anyways, also consider doing a search here on SO; you're not the first one to make this mistake.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!