mobile_scanner icon indicating copy to clipboard operation
mobile_scanner copied to clipboard

Warning during build on Android

Open Maatteogekko opened this issue 2 years ago • 3 comments

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.

Maatteogekko avatar Jun 17 '22 16:06 Maatteogekko

Or something lower since most android phones are still in Android 11, 10 or 9.

antony-jr avatar Jun 19 '22 18:06 antony-jr

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.

khkramer avatar Jun 21 '22 13:06 khkramer

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)

jochemc avatar Jun 27 '22 12:06 jochemc

Any update on this?

Hauglid avatar Dec 20 '22 14:12 Hauglid

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).

paricleu avatar Jan 03 '23 14:01 paricleu

You should always target the latest compileSdkVersion.

juliansteenbakker avatar Feb 09 '23 22:02 juliansteenbakker