Karthi
Karthi

Reputation: 13762

java.lang.NoClassDefFoundError: android.media.ThumbnailUtils

i try to use the android.media.ThumbnailUtils class to fetch the video thumbnails from the video which is locate under specified path, for that i use the following code,

Bitmap thumb = android.media.ThumbnailUtils.createVideoThumbnail("/sdcard/video/sample.mp4",
                MediaStore.Images.Thumbnails.MINI_KIND);
return thumb;

but it generates this exception.
java.lang.NoClassDefFoundError: android.media.ThumbnailUtils

Anyone suggest some idea to solve this.

Thanks.

Upvotes: 1

Views: 2847

Answers (3)

Li3ro
Li3ro

Reputation: 1877

I have stumbled java.lang.NoClassDefFoundError while using a class from a jar in my project. I tried many things and solve this by the following steps: right click on project > properties > Java Build Path > source > add folder > choose /lib (if your jar is in there ofcourse)

Hope this saves a day for you..

Upvotes: 1

Erich Douglass
Erich Douglass

Reputation: 52002

The NoClassDefFoundError makes me think that you're not targeting the right API level. ThumbnailUtils is only in the SDK as of API level 8 (2.2). Are you running against Froyo or later?

Upvotes: 2

Feanor
Feanor

Reputation: 2725

Anytime you get a NoClassDefFoundError, the virtual machine couldn't load the class you asked it to. In most cases, this is due to a classpath problem.

If you're using the Android ADT plugin with Eclipse, much of the classpath work is done for you via the build path. You can check your build path by right-clicking on your project, navigating to Properties>Java Build Path. See if there is a library or project missing there.

Upvotes: 0

Related Questions