Java.lang.NoClassDefFoundError: android.media.ThumbnailUtils

I am trying to use the android.media.ThumbnailUtils class to extract thumbnail videos from a video that is located at the specified path, for this I use the following code,

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

but throws this exception. java.lang.NoClassDefFoundError: android.media.ThumbnailUtils

Someone suggest some idea to solve this problem.

Thanks.

+1
source share
3 answers

NoClassDefFoundError makes me think that you are not targeting the correct API level. ThumbnailUtils is only in the SDK from API level 8 (2.2). Are you running against Froyo or later?

+2
source

I came across java.lang.NoClassDefFoundError using a class from jar in my project. I tried a lot of things and solved it with the following steps: right-click on the project> properties> Java build path> source> add folder> select / lib (if your bank is there)

Hope this saves you a day.

+1
source

At any time, when you receive NoClassDefFoundError , the virtual machine could not load the class to which you asked it. In most cases, this is due to a class problem.

If you use the Android ADT plugin with Eclipse, most of the work with the classpath is done for you through the build path. You can verify your build path by right-clicking on your project by going to Properties> Java Build Path. See if there is a library or project.

0
source

Source: https://habr.com/ru/post/1347783/


All Articles