aloisdeniel / media_gallery

A Flutter plugin that lists native gallery items.
MIT License
87 stars 33 forks source link

Getting java.lang.IllegalArgumentException: Invalid token LIMIT on Android 11 Emulator #19

Open mostafaAbdelazim opened 3 years ago

mostafaAbdelazim commented 3 years ago

I'm getting this exception on my android 11 emulator, I've further tested and it seems to be working fine on android 8.1 and 9 on physical devices, here is the code:

getImages() async { final List collections = await MediaGallery.listMediaCollections(mediaTypes: [MediaType.image]);

final MediaPage imagePage = await collections[0].getMedias( mediaType: MediaType.image, take: 500);

imagesMedia = imagePage.items..sort((x, y) => y.creationDate.compareTo(x.creationDate));
imageFile = await imagesMedia.first.getFile();
setState(() {});

}

and here is full log: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:415) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) Caused by: java.lang.IllegalArgumentException: Invalid token LIMIT at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142) at android.content.ContentProviderProxy.query(ContentProviderNative.java:472) at android.content.ContentResolver.query(ContentResolver.java:1183) at android.content.ContentResolver.query(ContentResolver.java:1115) at android.content.ContentResolver.query(ContentResolver.java:1071) at com.example.media_gallery.MediaGalleryPlugin.listImages(MediaGalleryPlugin.kt:269) at com.example.media_gallery.MediaGalleryPlugin.access$listImages(MediaGalleryPlugin.kt:20) at com.example.media_gallery.MediaGalleryPlugin$onMethodCall$3.invoke(MediaGalleryPlugin.kt:68) at com.example.media_gallery.MediaGalleryPlugin$onMethodCall$3.invoke(MediaGalleryPlugin.kt:20) at com.example.media_gallery.doAsync.doInBackground(MediaGalleryPlugin.kt:538) at com.example.media_gallery.doAsync.doInBackground(MediaGalleryPlugin.kt:532) at android.os.AsyncTask$3.call(AsyncTask.java:394) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:923) 

miyura commented 3 years ago

I see the same issue on Android 11 device. Any update on this issue would be appreciated.

mostafaAbdelazim commented 3 years ago

It has been 5 months, I guess this package is no longer maintained/updated

aloisdeniel commented 3 years ago

It is just a question of priority.

Fixing open sources issues doesn't pay the bills unfortunately...

A PR would help to fix the issue!

mostafaAbdelazim commented 3 years ago

@aloisdeniel Thanks for putting the time and effort for this package, it's highly appreciated. I just wanted to save @miyura time with a quick response that's all.

miyura commented 3 years ago

Thanks @aloisdeniel and @mostafaAbdelazim I will try to send a PR

aftoncreative commented 3 years ago

Hi guys, keep up the good work! This fix is greatly appreciated and waited. I would like to try this fix out. Is this fix implemented on some fork or how could I try it out?

miyura commented 3 years ago

@aftoncreative this fix is available here: https://github.com/Geostry/media_gallery Please give us feedback