BestBurning / platform_device_id

flutter plugin to get device id
https://pub.dev/packages?q=platform_device_id
BSD 3-Clause "New" or "Revised" License
81 stars 203 forks source link

Android Build Error #32

Open devalp-pro opened 1 year ago

devalp-pro commented 1 year ago

Android Gradle Error due to the latest version used in the project. Package contains lower grade and kotlin version that is not supported to build with latest Gradle version.


* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':platform_device_id' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.819], locale en-IN)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.73.1)
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.
YaizukStrange commented 1 year ago

i have the same error

shraddha-7span commented 1 year ago

Yes, I found same error, Please use 'device_info_plus' dependency and remove ' platform_device_id: ^1.0.1'

Use device_info_plus plugin developed by the Flutter community.

This is how you can get IDs on both platforms.

In your pubspec.yaml file add this: dependencies: device_info_plus: ^3.2.3

Create a method:

Future<String?> _getId() async { var deviceInfo = DeviceInfoPlugin(); if (Platform.isIOS) { // import 'dart:io' var iosDeviceInfo = await deviceInfo.iosInfo; return iosDeviceInfo.identifierForVendor; // unique ID on iOS } else if(Platform.isAndroid) { var androidDeviceInfo = await deviceInfo.androidInfo; return androidDeviceInfo.androidId; // unique ID on Android } }

cwangfr commented 1 year ago

use this gradle version is ok dependencies { classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }

008v commented 9 months ago

use this gradle version is ok dependencies { classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }

thank you . it works for me .