image_downloader icon indicating copy to clipboard operation
image_downloader copied to clipboard

On Android Plugin crashes using FlutterFragmentActivity

Open shavyg2 opened this issue 5 years ago • 1 comments
trafficstars

https://github.com/ko2ic/image_downloader/blob/master/android/src/main/kotlin/com/ko2ic/imagedownloader/ImageDownloaderPermissionListener.kt#L13

The issue is on this line, the number needs to fit within 16 bits so 0 - 65535, while the library is using 2578166

Question, does that number really matter or just needs to be a unique number?

The actual error is below

E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): Failed to handle method call
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at androidx.fragment.app.FragmentActivity.checkForValidRequestCode(FragmentActivity.java:715)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at androidx.fragment.app.FragmentActivity.validateRequestPermissionsRequestCode(FragmentActivity.java:730)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:500)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at com.ko2ic.imagedownloader.ImageDownloaderPermissionListener.alreadyGranted(ImageDownloaderPermissionListener.kt:46)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at com.ko2ic.imagedownloader.ImageDownloaderPlugin.onMethodCall(ImageDownloaderPlugin.kt:65)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#plugins.ko2ic.com/image_downloader(14041): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

shavyg2 avatar Mar 25 '20 19:03 shavyg2

If this is cool and you don't mind a pull request, I can do that too, really want to get this fix working. Thx

shavyg2 avatar Mar 25 '20 19:03 shavyg2