Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compile]: Android static Build.SERIAL deprecated #3380

Closed
8 tasks done
gsi-ileonf92 opened this issue Dec 3, 2024 · 2 comments
Closed
8 tasks done

[Compile]: Android static Build.SERIAL deprecated #3380

gsi-ileonf92 opened this issue Dec 3, 2024 · 2 comments
Labels
compile Compilation error triage

Comments

@gsi-ileonf92
Copy link

Operating System

Android

Plugin

device_info_plus

Version

11.1.1

Flutter SDK

3.24.5

Compilation command

flutter build apk

Dart Dependencies

name: flutter_mobile_app
description: "A new Flutter project."
publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: ">=3.2.2 <4.0.0"

dependencies:
  async: ^2.11.0
  azlistview: ^2.0.0
  badges: ^3.1.2
  confetti: ^0.8.0
  connectivity_plus: ^6.0.5
  cupertino_icons: ^1.0.2
  dart_jsonwebtoken: ^2.13.0
  device_info_plus: ^11.1.1
  file_picker: ^8.1.2
  firebase_analytics: ^11.3.5
  firebase_core: ^3.8.0
  firebase_crashlytics: ^4.1.5
  firebase_messaging: ^15.1.5
  flutter:
    sdk: flutter
  flutter_animate: ^4.3.0
  flutter_dotenv: ^5.1.0
  flutter_image_compress: ^2.3.0
  flutter_local_notifications: ^18.0.1
  flutter_localizations:
    sdk: flutter
  flutter_native_splash: ^2.3.8
  flutter_spinkit: ^5.2.1
  flutter_svg: ^2.0.9
  freezed_annotation: ^2.4.1
  get: ^4.6.6
  hive_flutter: ^1.1.0
  http: ^1.2.0
  http_parser: ^4.0.2
  image: ^4.2.0
  image_picker: ^1.1.2
  internet_connection_checker: ^1.0.0+1
  intl: ^0.19.0
  intl_phone_number_input: ^0.7.4
  json_annotation: ^4.8.1
  logger: ^2.5.0
  mask_text_input_formatter: ^2.9.0
  mime: ^2.0.0
  path: ^1.9.0
  path_provider: ^2.1.3
  permission_handler: ^11.3.1
  pinput: ^5.0.0
  skeletonizer: ^1.1.1
  transparent_image: ^2.0.1
  url_launcher: ^6.2.3
  uuid: ^4.5.1
  webview_flutter: ^4.7.0
dev_dependencies:
  build_runner: ^2.4.8
  flutter_launcher_icons: ^0.14.1
  flutter_lints: ^5.0.0
  flutter_test:
    sdk: flutter
  freezed: ^2.4.7
  hive_generator: ^2.0.1
  json_serializable: ^6.7.1

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icons/icon_app.png"
  background_color: "#ffffff"
  web:
    generate: false
  windows:
    generate: false
  macos:
    generate: false

flutter:
  uses-material-design: true

  assets:
    - .env
    - assets/images/
    - assets/icons/
    - assets/icons/navigation_bar/

  fonts:
    - family: Noto Sans
      fonts:
        - asset: assets/fonts/NotoSans.ttf

flutter_native_splash:
  background_image: "assets/images/splash_background.png"
  image: assets/images/splash_logo.png
  android_12:
    branding: assets/images/splash_logo.png
  android: true
  ios: true
  web: false
  android_screen_orientation: sensorPortrait
  fullscreen: true

Native dependencies

No response

Compilation Error

exception: /Users/runner/.pub-cache/hosted/pub.dev/device_info_plus-11.1.1/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:75:47: warning: 'SERIAL: String!' is deprecated. Deprecated in Java
exception:                 build["serialNumber"] = Build.SERIAL
exception:                                               ^

Flutter Doctor

[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.22631.4460], locale en-US)
    • Flutter version 3.24.5 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (3 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at d:\installers\android-sdk-windows\
    • Platform android-34-ext8, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Users\UserX\AppData\Local\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] Connected device (5 available)
    • 68c7b167            • android-arm64  • Android 13 (API 33)
    • Galaxy S10 (mobile) • 127.0.0.1:6555 • android-x64    • Android 13 (API 33)
    • Windows (desktop)   • windows        • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Chrome (web)        • chrome         • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)          • edge           • web-javascript • Microsoft Edge 131.0.2903.63

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@gsi-ileonf92 gsi-ileonf92 added compile Compilation error triage labels Dec 3, 2024
@miquelbeltran
Copy link
Member

The plugin already checks on the android version and uses getSerial() instead from Android 26 ("O") and above, I am not sure why the compiler complained about it:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
build["serialNumber"] = try {
Build.getSerial()
} catch (ex: SecurityException) {
Build.UNKNOWN
}
} else {
build["serialNumber"] = Build.SERIAL
}

Running flutter build apk on the example project doesn't show this error.

➜  example git:(main) flutter build apk

// removed 

warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
Generating lint files for backported methods only (compile API B)
Running Gradle task 'assembleRelease'...                          143.6s
✓ Built build/app/outputs/flutter-apk/app-release.apk (19.1MB)

Can you paste your full flutter build apk output, and as well check if you have any custom lint rules?

@gsi-ileonf92
Copy link
Author

@miquelbeltran looks like it's not happening again. I've tried to replicate the warning in order to give you a more detailed way to reproduce it but everything looks good now.
Thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile Compilation error triage
Projects
None yet
Development

No branches or pull requests

2 participants