mobile_scanner
mobile_scanner copied to clipboard
Warning during build on Android
I am on Flutter 3.0.2 and mobile_scanner 2.0.0. I get this warning when building on android.
Launching lib/main.dart on sdk gphone arm64 in debug mode...
lib/main.dart:1
Warning: The plugin mobile_scanner requires Android SDK version 32.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to /Users/gekko/code/app_refactoring/android/app/build.gradle:
android {
compileSdkVersion 32
...
}
What is purpose to use compileSdkVersion 32? If you don't have any reasons, I think that you should use the same of the flutter framework (current is 31). https://github.com/flutter/flutter/blob/977c35307fec91301973f8b6edd43cf3b617f684/packages/flutter_tools/gradle/flutter.gradle#L33
Thanks.
Or something lower since most android phones are still in Android 11, 10 or 9.
Especially since the documentation states the actual required SDK version is 18 i'm curious as to why it suddenly requires the most recent version.
Or something lower since most android phones are still in Android 11, 10 or 9.
This is the compile SDK, not the minimum SDK. So it doesn't restrict which users can run your app. Nevertheless, the issue still stands as far as I am concerned, as the mismatch with Flutter's current compile SDK (31) is annoying, so unless it's for a very good (technical) reason, this shouldn't be the case.
(although if it were for a good (technical) reason, I'd not expect it to work regardless of the error message, but it does)
Any update on this?
It seems that androidx.camera:camera-camera2:1.2.0
needs compileSdkVersion
to be set to 32 or higher and thats why this plugin uses a higher version than flutters default of 31.
I haven't had any issues with just setting my compileSdkVersion
to 32 or even 33 so I don't think it's that big of an issue (But your mileage may vary).
You should always target the latest compileSdkVersion
.