sc4v3ng3r / flutter_audio_query

Flutter Audio Query Plugin
https://pub.dev/packages/flutter_audio_query
MIT License
52 stars 47 forks source link

await playlist[0].addSong(song: songs[2] ) ERROR on Android 10 #54

Open ariancamejo opened 3 years ago

ariancamejo commented 3 years ago

I/flutter (18755): adding song 331 to playlist 1728 E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): Failed to handle method call E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): java.lang.IllegalArgumentException: Invalid column count() E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.content.ContentProviderProxy.query(ContentProviderNative.java:423) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.content.ContentResolver.query(ContentResolver.java:951) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.content.ContentResolver.query(ContentResolver.java:887) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.content.ContentResolver.query(ContentResolver.java:843) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at boaventura.com.devel.br.flutteraudioquery.loaders.PlaylistLoader.getBase(PlaylistLoader.java:293) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at boaventura.com.devel.br.flutteraudioquery.loaders.PlaylistLoader.addSongToPlaylist(PlaylistLoader.java:195) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at boaventura.com.devel.br.flutteraudioquery.delegate.AudioQueryDelegate.handleWriteMethods(AudioQueryDelegate.java:457) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at boaventura.com.devel.br.flutteraudioquery.delegate.AudioQueryDelegate.playlistSourceHandler(AudioQueryDelegate.java:274) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at boaventura.com.devel.br.flutteraudioquery.FlutterAudioQueryPlugin.onMethodCall(FlutterAudioQueryPlugin.java:111) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.os.MessageQueue.next(MessageQueue.java:336) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.os.Looper.loop(Looper.java:197) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at android.app.ActivityThread.main(ActivityThread.java:7860) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/MethodChannel#boaventura.com.devel.br.flutteraudioquery(18755): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075) E/flutter (18755): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, Invalid column count(), null, java.lang.IllegalArgumentException: Invalid column count(*) E/flutter (18755): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170) E/flutter (18755): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140) E/flutter (18755): at android.content.ContentProviderProxy.query(ContentProviderNative.java:423) E/flutter (18755): at android.content.ContentResolver.query(ContentResolver.java:951) E/flutter (18755): at android.content.ContentResolver.query(ContentResolver.java:887) E/flutter (18755): at android.content.ContentResolver.query(ContentResolver.java:843) E/flutter (18755): at boaventura.com.devel.br.flutteraudioquery.loaders.PlaylistLoader.getBase(PlaylistLoader.java:293) E/flutter (18755): at boaventura.com.devel.br.flutteraudioquery.loaders.PlaylistLoader.addSongToPlaylist(PlaylistLoader.java:195) E/flutter (18755): at boaventura.com.devel.br.flutteraudioquery.delegate.AudioQueryDelegate.handleWriteMethods(AudioQueryDelegate.java:457) E/flutter (18755): at boaventura.com.devel.br.flutteraudioquery.delegate.AudioQueryDelegate.playlistSourceHandler(AudioQueryDelegate.java:274) E/flutter (18755): at boaventura.com.devel.br.flutteraudioquery.FlutterAudioQueryPlugin.onMethodCall(FlutterAudioQueryPlugin.java:111) E/flutter (18755): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/flutter (18755): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/flutter (18755): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/flutter (18755): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter (18755): at android.os.MessageQueue.next(MessageQueue.java:336) E/flutter (18755): at android.os.Looper.loop(Looper.java:197) E/flutter (18755): at android.app.ActivityThread.main(ActivityThread.java:7860) E/flutter (18755): at java.lang.reflect.Method.invoke(Native Method) E/flutter (18755): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/flutter (18755): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075) E/flutter (18755): ) E/flutter (18755): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7) E/flutter (18755): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18) E/flutter (18755): E/flutter (18755): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12) E/flutter (18755): #3 PlaylistInfo.addSong (package:flutter_audio_query/src/playlist_info.dart:30:41) E/flutter (18755): #4 Biblioteca.addSongsToPlaylist (package:music/provider/biblioteca.dart:59:24) E/flutter (18755): E/flutter (18755): #5 _Page.build... (package:music/ui/play/screens/open.dart:111:54) E/flutter (18755): #6 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter (18755): #7 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter (18755): #8 _FutureListener.handleValue (dart:async/future_impl.dart:143:18) E/flutter (18755): #9 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45) E/flutter (18755): #10 Future._propagateToListeners (dart:async/future_impl.dart:725:32) E/flutter (18755): #11 Future._completeWithValue (dart:async/future_impl.dart:529:5) E/flutter (18755): #12 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7) E/flutter (18755): #13 _rootRun (dart:async/zone.dart:1190:13) E/flutter (18755): #14 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (18755): #15 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (18755): #16 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (18755): #17 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) E/flutter (18755): #18 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) E/flutter (18755): W/System (18755): A resource failed to call close.

EshanNimesha01 commented 3 years ago

yes, same here await playlistInfo.addSong(song: songInfo);

java.lang.IllegalArgumentException: Invalid column count(*)

ayob2k commented 3 years ago

i have same issue

MohamedSaad8 commented 3 years ago

i have the same issue . is there one solve it here ?

ayob2k commented 3 years ago

@MohamedSaad8 just store them manually using SharedPreference thats what i did

bimemto commented 3 years ago

Change the getBase function in PlaylistLoader.java into this:

private int getBase(final Uri playlistUri) { int base = -1; Cursor cursor = getContentResolver().query(playlistUri, null, null, null, null); if (cursor != null) { cursor.moveToNext(); base = cursor.getCount(); base += 1; cursor.close(); } return base; }

talamaska commented 3 years ago

@bimemto Even with that change Android is failing. Seems like Android 10 bug, seen some reports in Stackoverflow and on the official android issues.