snapp_cli icon indicating copy to clipboard operation
snapp_cli copied to clipboard

Add device fails

Open JohanScheepers opened this issue 1 year ago • 7 comments

Adding a new device fails.

I can ran snapp_cli devices add, snapp-cli bootstrap -v or snapp-cli bootstrap.

Error: C:\Users\Johan>snapp_cli devices add

[WARN] Add command is a way to add a new device to custom devices manually.

We recommend you to use the bootstrap command to setup a device from scratch.

You need to provide specific PATH to the custom embedder you want to use.

✔ Please select the type of device you want to setup. · Express (recommended)

✔ Select your device · Raspberry Pi 4 Model B Could not load custom device from config index 0: Expected enabled to be a boolean.

Environment: Windows 10

Flutter 3.24.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 4cf269e36d (8 days ago) • 2024-09-03 14:30:00 -0700 Engine • revision a6bd3f1de1 Tools • Dart 3.5.2 • DevTools 2.37.2

snapp-cli were installed today

JohanScheepers avatar Sep 11 '24 12:09 JohanScheepers

Hey @JohanScheepers

Thanks for opening this issue

I'll try to take a look at this issue ASAP.

payam-zahedi avatar Sep 11 '24 12:09 payam-zahedi

It seems the problem is related to your custom_devices.json file and the custom devices configured there.

Let's check several things together:

  1. Verify Administrator Privileges

    Ensure that your Windows user account has administrator privileges to modify Flutter SDK files. Alternatively, you can run your CLI as an administrator. Make sure you have permission to read and write administrative files.

  2. Enable Custom Device Configuration

    Confirm that the custom device configuration is enabled in your Flutter SDK. You can check this by running:

    flutter config --list
    

    The output should resemble:

    All Settings:
       enable-web: (Not set)
       enable-linux-desktop: true
       enable-macos-desktop: (Not set)
       enable-windows-desktop: (Not set)
       enable-android: true
       enable-ios: (Not set)
       enable-fuchsia: (Not set) (Unavailable)
       enable-custom-devices: true
       cli-animations: (Not set)
       enable-native-assets: (Not set) (Unavailable)
       enable-flutter-preview: (Not set) (Unavailable)
       enable-swift-package-manager: (Not set) (Unavailable)
    

    If enable-custom-devices is not enabled, you can enable it with the following command:

    flutter config --enable-custom-device
    
  3. Inspect custom_devices.json File Check your custom_devices.json file for any issues, such as syntax errors. Consider making a backup of this file, then empty its contents, and run the command again to see if the problem persists.

payam-zahedi avatar Sep 20 '24 08:09 payam-zahedi

Have checked

flutter config --list

All Settings: enable-web: true enable-linux-desktop: true enable-macos-desktop: (Not set) enable-windows-desktop: (Not set) enable-android: (Not set) enable-ios: (Not set) enable-fuchsia: (Not set) (Unavailable) enable-custom-devices: true cli-animations: (Not set) enable-native-assets: (Not set) (Unavailable) enable-flutter-preview: (Not set) (Unavailable) enable-swift-package-manager: (Not set) (Unavailable) android-sdk: C:\Users\Johan\AppData\Local\Android\Sdk `

Where is the custom_devices.json located by default on a Windows OS?

JohanScheepers avatar Oct 01 '24 10:10 JohanScheepers

Where is the custom_devices.json located by default on a Windows OS?

To locate the custom_devices.json file on a Windows OS, you can use one of the following commands:


flutter custom-devices list

or 

snapp_cli devices list 

These commands will display a list of custom devices, and the output will also include the path to the custom_devices.json file.

Example

List of custom devices in "/Users/payam/.config/flutter/custom_devices.json":
  id: pi-5, label: Raspberry Pi 5-[Flutter-pi], enabled: true

payam-zahedi avatar Oct 01 '24 10:10 payam-zahedi

Thank you

C:\Users\Johan>snapp_cli devices list ✗ Searching for custom devices failed! (2.6s) Null check operator used on a null value

C:\Users\Johan>flutter custom-devices list Could not load custom device from config index 0: Expected enabled to be a boolean. Could not list custom devices.

C:\Users\Johan>snapp_cli bootstrap

Bootstrap command is a way to setup a device from scratch. It will add a new device to custom devices, create a ssh connection to the device, install flutter on the device and finally help you to run your app on the device.

some changes

let's start!

✔ Please select the type of device you want to setup. · Express (recommended)

✔ Select your device · Raspberry Pi 4 Model B Could not load custom device from config index 0: Expected enabled to be a boolean. Could not load custom device from config index 0: Expected enabled to be a boolean.

JohanScheepers avatar Oct 01 '24 11:10 JohanScheepers

Alright @JohanScheepers

Thanks for these detail

It seems you have a syntax or type error on your custom_device.json file, so flutter can not parse it.

I'm trying to find the default path of custom_devices.json file in windows

payam-zahedi avatar Oct 01 '24 12:10 payam-zahedi

Can you check this location @JohanScheepers

C:\Users\USERNAME\AppData\Roaming

or maybe search for a custom_devices.json inside your Username folder?

payam-zahedi avatar Oct 01 '24 12:10 payam-zahedi

@JohanScheepers I'll close this issue

Feel free to reopen it if it is still not working for you

payam-zahedi avatar Oct 30 '24 11:10 payam-zahedi