Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

No implementation for method requestCameraPermission ( 3.0.0-dev.3) #211

Closed
djlegge opened this issue Apr 16, 2020 · 6 comments
Closed

No implementation for method requestCameraPermission ( 3.0.0-dev.3) #211

djlegge opened this issue Apr 16, 2020 · 6 comments

Comments

@djlegge
Copy link

djlegge commented Apr 16, 2020

Hi
Using the new version 3.0.0-dev.3 for Android, it works very well in the debug build but if I build an app bundle to test the release build I get "MissingPluginException(No implementation found for method requestCameraPermission on channel de.mintware.barcode_scan)".
This happens every time you try a scan.
Any ideas ? Thanks...

@devtronic
Copy link
Member

Please provide a minimal working example to reproduce the problem. Are you using proguard?

@djlegge
Copy link
Author

djlegge commented Apr 17, 2020

Thanks for the quick response !
Double checking everything this morning, flutter run --release DOES work - the app asks for the camera permissions etc.
The problem is when you build app bundle or apks and install them outside of flutter.
The flutter_barcode_reader example project does the same thing.

flutter build apk
adb install build/app/outputs/apk/release/app-release.apk 

... does not work.
It seems I am using proguard as it is the default. Building the apk's or bundle with the --no-shrink option fixes the problem.

@devtronic
Copy link
Member

devtronic commented Apr 17, 2020

Please try to add -keep class de.mintware.** { *; } to your proguard rules and tell if it works.
Maybe it's because some methods in the platform code are executed by reflection instead of invoking them directly. This will be probably recognized as "dead code" in the release build.

@djlegge
Copy link
Author

djlegge commented Apr 17, 2020

Yes, that works. I had to create the android/app/proguard-rules.pro file as it didn't exist.
I did not myself enable proguard, it's R8 that is enabled by default apparently.
Anyway, thanks so much for your help and for this great package library.

@devtronic
Copy link
Member

Perfect, thanks for the information! I'll check if I can create a proguard-rules.pro file for the package so users don't need to activate it by them self. If it's not possible I'll update the docs!

@devtronic
Copy link
Member

The latest version (3.0.0) contains a fix for the problem so you don't need to add the rule to the proguard file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants