Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError #5

Open
wangshufu opened this issue Jan 15, 2021 · 6 comments
Open

NoSuchMethodError #5

wangshufu opened this issue Jan 15, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@wangshufu
Copy link

wangshufu commented Jan 15, 2021

Running in Android 10 is successful ,but Android 7.1.1 is failure
HeifConverter.useContext(this)
.fromFile("/sdcard/nut/IMG_61072668.heic")
.withOutputFormat(HeifConverter.Format.JPEG)
.withOutputQuality(100)
.saveFileWithName("Image_Converted_Name")
.saveResultImage(true)
.convert {
println(it[HeifConverter.Key.IMAGE_PATH] as String)
resultImage.setImageBitmap((it[HeifConverter.Key.BITMAP] as Bitmap))
}

This file exists!!!

java.lang.NoSuchMethodError: No virtual method limit(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
    at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:84)
    at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107)
    at org.mp4parser.IsoFile.<init>(IsoFile.java:57)
    at org.mp4parser.IsoFile.<init>(IsoFile.java:52)
    at linc.com.heifconverter.HeifReader.decodeByteArray(HeifReader.kt:106)
    at linc.com.heifconverter.HeifReader.decodeFile(HeifReader.kt:150)
    at linc.com.heifconverter.HeifConverter$convert$2$1.invokeSuspend(HeifConverter.kt:139)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
@lincollincol
Copy link
Owner

Hello @wangshufu, thank you for reporting this bug. I'll try to fix it soon!

@lincollincol lincollincol self-assigned this Jan 16, 2021
@lincollincol lincollincol added the bug Something isn't working label Jan 16, 2021
@rizwankhanMiranshah
Copy link

private suspend fun renderHevcImageWithFormat(
bitstream: ByteBuffer,
info: ImageInfo,
imageFormat: Int
): Bitmap {
ImageReader.newInstance(
info.size!!.width,
info.size!!.height,
imageFormat,
1
).use { reader ->
val bitmapDeferred = CoroutineScope(Dispatchers.Default).async {
renderHevcImage(bitstream, info, reader.surface)
var image: Image? = null

            return@async try {
                image = try {
                    reader.acquireNextImage()
                } catch (ex: UnsupportedOperationException) {
                    throw FormatFallbackException(ex)
                }
                when (image.format) {
                    ImageFormat.YUV_420_888, ImageFormat.YV12 -> convertYuv420ToBitmap(image)
                    ImageFormat.RGB_565 -> convertRgb565ToBitmap(image)
                    else -> throw RuntimeException("unsupported image format(" + image.format + ")")
                }
            } finally {
                image?.close()
            }
        }
        return@renderHevcImageWithFormat bitmapDeferred.await()
    }
}

@rizwankhanMiranshah
Copy link

Screenshot 2021-03-09 at 12 37 36 AM

showing me this error when import in android studio

@AlexGolovach
Copy link

Hello, @lincollincol have you any updates about this problem?

@lincollincol
Copy link
Owner

Hello @AlexGolovach. Currently, I don't have enough time to fix it fast but I'm still looking for a solution at free time

@Vinny94051
Copy link

Screenshot 2021-03-09 at 12 37 36 AM showing me this error when import in android studio

I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants