I created a Flutter app that uses the network_info_plus 3.0.1 package (https://pub.dev/packages/network_info_plus). It works well when I run it out of the IDE Webstorm. When I build it as a snap package, it runs, but fails with an error when using the Network Info Plus package.
Here is the error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.282" (uid=1001 pid=101830 comm="/snap/roku-remotes/x4/bin/roku_remotes" label="snap.roku-remotes.roku-remotes (enforce)") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=1583 comm="/usr/sbin/NetworkManager --no-daemon" label="unconfined")
#0 DBusClient._callMethod (package:dbus/src/dbus_client.dart:1124)
<asynchronous suspension>
#1 DBusClient.callMethod (package:dbus/src/dbus_client.dart:608)
<asynchronous suspension>
#2 DBusRemoteObjectManager.getManagedObjects (package:dbus/src/dbus_remote_object_manager.dart:80)
<asynchronous suspension>
#3 NetworkManagerClient.connect (package:nm/src/network_manager_client.dart:2351)
<asynchronous suspension>
#4 NetworkInfoPlusLinuxPlugin._getConnectionValue (package:network_info_plus/src/network_info_plus_linux.dart:87)
<asynchronous suspension>
#5 ScanNetworkController.scanMulticast (package:roku_remotes/pages/scan_network/scan_network_controller.dart:57)
<asynchronous suspension>
I tried adding more plugs to the snapcraft.yaml
. Here is a copy of the full yaml:
name: roku-remotes # you probably want to 'snapcraft register <name>'
version: 0.4.0 # just for humans, typically '1.2+git' or '1.3.2'
summary: Let's use Roku # 79 char long summary
description: Text desc for app...
confinement: strict # use 'strict' once you have the right plugs and slots
base: core18 # the base snap is the execution environment for this snap
grade: stable # must be 'stable' to release into candidate/stable channels
icon: snap/gui/roku-remotes.png
apps:
roku-remotes:
command: roku_remotes
extensions: [flutter-dev] # Where "master" defines which Flutter channel to use for the build
plugs:
- network
- network-manager
- desktop
- home
parts:
roku-remotes:
source: .
plugin: flutter
flutter-target: lib/main.dart # The main entry-point file of the application
TBH, I don't know a lot about bundling an app with snapcraft. I'm stuck on this and any help is appreciated. Thanks in advance!