fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.59k stars 959 forks source link

[Compile]: Gradle 8.4 dont compile #3316

Open arrrrny opened 2 days ago

arrrrny commented 2 days ago

Operating System

Mac OS Seqouia

Plugin

device_info_plus

Version

11.0.0

Flutter SDK

3.24.3

Compilation command

./gradlew clean ./gradlew build --refresh-dependencies

Dart Dependencies

No response

Native dependencies

No response

Compilation Error

> Task :device_info_plus:lintDebug FAILED
Lint found 1 errors, 3 warnings. First failure:

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:70: Error: Missing permissions required by Build.getSerial: android.permission.READ_PRIVILEGED_PHONE_STATE [MissingPermission]
                    Build.getSerial()
                    ~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingPermission":
   This check scans through your code and libraries and looks at the APIs
   being used, and checks this against the set of permissions required to
   access those APIs. If the code using those APIs is called at runtime, then
   the program will crash.

   Furthermore, for permissions that are revocable (with targetSdkVersion 23),
   client code must also be prepared to handle the calls throwing an exception
   if the user rejects the request for permission at runtime.

The full lint text report is located at:
  /Users/arrrrny/Developer/zikzak/build/device_info_plus/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':device_info_plus:lintDebug'.
> Lint found errors in the project; aborting build.

  Fix the issues identified by lint, or create a baseline to see only new errors.
  To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:

  android {
      lint {
          baseline = file("lint-baseline.xml")
      }
  }

For more details, see https://developer.android.com/studio/write/lint#snapshot

Lint found 1 errors, 3 warnings. First failure:

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:70: Error: Missing permissions required by Build.getSerial: android.permission.READ_PRIVILEGED_PHONE_STATE [MissingPermission] Build.getSerial()



     Explanation for issues of type "MissingPermission":
     This check scans through your code and libraries and looks at the APIs
     being used, and checks this against the set of permissions required to
     access those APIs. If the code using those APIs is called at runtime, then
     the program will crash.

     Furthermore, for permissions that are revocable (with targetSdkVersion 23),
     client code must also be prepared to handle the calls throwing an exception
     if the user rejects the request for permission at runtime.

  The full lint text report is located at:
    /Users/arrrrny/Developer/zikzak/build/device_info_plus/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt
```

### Flutter Doctor

```shell
~/D/z/android ❯❯❯ flutter doctor -v
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348
    darwin-arm64, locale en-TR)
    • Flutter version 3.24.3 on channel stable at
      /Users/arrrrny/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11
      16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK
    version 35.0.0)
    • Android SDK at /Users/arrrrny/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/arrrrny/Library/Android/sdk
    • Java binary at:
      /opt/homebrew/Cellar/openjdk@17/17.0.12/libexec/openjdk.jd
      k/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Homebrew (build
      17.0.12+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google
      Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android
      Studio.app/Contents
    • 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
      21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.94.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554
      • android-arm64  • Android 13 (API 33) (emulator)
    • ARRRRNY (mobile)                •
      00008101-00115C381E10801E • ios            • iOS 18.0.1
      22A3370
    • macOS (desktop)                 • macos
      • darwin-arm64   • macOS 15.0.1 24A348 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad
      • darwin         • macOS 15.0.1 24A348 darwin-arm64
    • Chrome (web)                    • chrome
      • web-javascript • Google Chrome 129.0.6668.100

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

• No issues found!
```

### Checklist before submitting a bug

- [X] I searched issues in this repository and couldn't find such bug/problem
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with `flutter pub upgrade`
- [X] I did a `flutter clean`
- [X] I tried running the example project
arrrrny commented 2 days ago

I added the lintOptions as mentioned in the https://github.com/fluttercommunity/plus_plugins/issues/1986.

lintOptions {
      disable 'MissingPermission'
}

But it did not build when I run. Example app is missing the gradlew folder, I needed to run flutter create .

Then within the android folder run below:

./gradlew clean
./gradlew build --refresh-dependencies

You will get exactly the same error as below:

Task :device_info_plus:lintReportDebug Wrote HTML report to file:///Users/arrrrny/Developer/sandbox/fluttercommunity%20plus_plugins%20main%20packages-device_info_plus/device_info_plus/example/build/device_info_plus/reports/lint-results-debug.html

Task :device_info_plus:lintDebug FAILED Lint found 1 errors, 3 warnings. First failure:

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:70: Error: Missing permissions required by Build.getSerial: android.permission.READ_PRIVILEGED_PHONE_STATE [MissingPermission] Build.getSerial()


   Explanation for issues of type "MissingPermission":
   This check scans through your code and libraries and looks at the APIs
   being used, and checks this against the set of permissions required to
   access those APIs. If the code using those APIs is called at runtime, then
   the program will crash.

   Furthermore, for permissions that are revocable (with targetSdkVersion 23),
   client code must also be prepared to handle the calls throwing an exception
   if the user rejects the request for permission at runtime.

The full lint text report is located at:
  /Users/arrrrny/Developer/sandbox/fluttercommunity plus_plugins main packages-device_info_plus/device_info_plus/example/build/device_info_plus/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':device_info_plus:lintDebug'.
> Lint found errors in the project; aborting build.

  Fix the issues identified by lint, or create a baseline to see only new errors.
  To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:
  ```
  android {
      lint {
          baseline = file("lint-baseline.xml")
      }
  }
  ```
  For more details, see https://developer.android.com/studio/write/lint#snapshot

  Lint found 1 errors, 3 warnings. First failure:

  /Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:70: Error: Missing permissions required by Build.getSerial: android.permission.READ_PRIVILEGED_PHONE_STATE [MissingPermission]
                      Build.getSerial()
 Explanation for issues of type "MissingPermission":
 This check scans through your code and libraries and looks at the APIs
 being used, and checks this against the set of permissions required to
 access those APIs. If the code using those APIs is called at runtime, then
 the program will crash.

 Furthermore, for permissions that are revocable (with targetSdkVersion 23),
 client code must also be prepared to handle the calls throwing an exception
 if the user rejects the request for permission at runtime.

The full lint text report is located at: /Users/arrrrny/Developer/sandbox/fluttercommunity plus_plugins main packages-device_info_plus/device_info_plus/example/build/device_info_plus/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt

Here is the content of the debug:

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:70: Error: Missing permissions required by Build.getSerial: android.permission.READ_PRIVILEGED_PHONE_STATE [MissingPermission]
                    Build.getSerial()
                    ~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingPermission":
   This check scans through your code and libraries and looks at the APIs
   being used, and checks this against the set of permissions required to
   access those APIs. If the code using those APIs is called at runtime, then
   the program will crash.

   Furthermore, for permissions that are revocable (with targetSdkVersion 23),
   client code must also be prepared to handle the calls throwing an exception
   if the user rejects the request for permission at runtime.

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/build.gradle:12: Warning: A newer version of com.android.tools.build:gradle than 8.3.1 is available: 8.7.0. (There is also a newer version of 8.3.𝑥 available, if upgrading to 8.7.0 is difficult: 8.3.2) [AndroidGradlePluginVersion]
        classpath 'com.android.tools.build:gradle:8.3.1'
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "AndroidGradlePluginVersion":
   This detector looks for usage of the Android Gradle Plugin where the
   version you are using is not the current stable release. Using older
   versions is fine, and there are cases where you deliberately want to stick
   with an older version. However, you may simply not be aware that a more
   recent version is available, and that is what this lint check helps find.

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/build.gradle:51: Warning: A newer version of org.jetbrains.kotlin:kotlin-stdlib than 1.8.22 is available: 2.0.20 [GradleDependency]
        implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "GradleDependency":
   This detector looks for usages of libraries where the version you are using
   is not the current stable release. Using older versions is fine, and there
   are cases where you deliberately want to stick with an older version.
   However, you may simply not be aware that a more recent version is
   available, and that is what this lint check helps find.

/Users/arrrrny/.pub-cache/hosted/pub.dev/device_info_plus-11.0.0/android/src/main/kotlin/dev/fluttercommunity/plus/device_info/MethodCallHandlerImpl.kt:75: Warning: Using SERIAL to get device identifiers is not recommended [HardwareIds]
                build["serialNumber"] = Build.SERIAL
                                              ~~~~~~

   Explanation for issues of type "HardwareIds":
   Using these device identifiers is not recommended other than for high value
   fraud prevention and advanced telephony use-cases. For advertising
   use-cases, use AdvertisingIdClient$Info#getId and for analytics, use
   InstanceId#getId.

   https://developer.android.com/training/articles/user-data-ids.html

1 errors, 3 warnings