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

Lost connection to device #21

Open Andregrps opened 3 years ago

Andregrps commented 3 years ago

When trying to get the device id from the windows desktop, a few seconds later it is crashing, and closing the application without showing any error log.

Currently my project is not null safety!

flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [versão 10.0.19042.1083], locale pt-BR)
    • Flutter version 2.2.3 at C:\Users\progmaq02\Documents\src\flutter
    • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\progmaq02\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31129.286
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 4.1.0)
    • 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 1.8.0_242-release-1644-b01)

[√] VS Code, 64-bit edition (version 1.57.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.24.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [versão 10.0.19042.1083]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 91.0.4472.124
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 91.0.864.67
zhibaiwei commented 2 years ago

I also found the same problem,Currently my project is null safety!

Ali-Fadaei commented 2 years ago

i have same problem!

iommi87 commented 2 years ago

Same problem.

Ali-Fadaei commented 2 years ago

any update?!

Dusk-afk commented 2 years ago

I found a solution. Thanks to @wangbax from here.

Just use this SIMPLE function in your flutter windows app

import 'dart:convert';
import 'dart:io';

Future<String> getBiosID() async {
  String biosID = '';
  final process = await Process.start(
    'wmic',
    ['csproduct', 'get', 'uuid'],
    mode: ProcessStartMode.detachedWithStdio,
  );
  final result = await process.stdout.transform(utf8.decoder).toList();
  for (var element in result) {
    final item = element.replaceAll(RegExp('\r|\n|\\s|UUID|uuid'), '');
    if (item.isNotEmpty) {
      biosID = item;
    }
  }
  return biosID;
}

This will return the exact same result that the plugin does. Plus, it also removes the terminal window pop up. Also you don't even need to use this platform_device_id package.

DomingoMG commented 1 year ago

The solution offered is valid for the following platforms: Windows, MacOS and Linux?

Is it only specifically Windows?

Dusk-afk commented 1 year ago

The solution offered is valid for the following platforms: Windows, MacOS and Linux?

Is it only specifically Windows?

nikitatg commented 1 year ago

The solution offered is valid for the following platforms: Windows, MacOS and Linux?

Is it only specifically Windows?

Tested on Windows 10/11, Ubuntu 20 and MacOS. Works well