简体   繁体   中英

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.

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?

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..

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.

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