flutternetwork / WiFiFlutter

Flutter plugin suite for various WiFi services.
https://wifi.flutternetwork.dev
285 stars 176 forks source link

java.lang.IllegalArgumentException: Unsupported value: 'WIFI_AP_STATE_DISABLED' of type 'class info.whitebyte.hotspotmanager.WIFI_AP_STATE' #312

Open Doldrums opened 1 year ago

Doldrums commented 1 year ago

in plugin example

java.lang.IllegalArgumentException: Unsupported value: 'WIFI_AP_STATE_DISABLED' of type 'class info.whitebyte.hotspotmanager.WIFI_AP_STATE'
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:297)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:63)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:267)
E/MethodChannel#wifi_iot(23667):    at com.alternadom.wifiiot.WifiIotPlugin.getWiFiAPState(WifiIotPlugin.java:675)
E/MethodChannel#wifi_iot(23667):    at com.alternadom.wifiiot.WifiIotPlugin.onMethodCall(WifiIotPlugin.java:309)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#wifi_iot(23667):    at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#wifi_iot(23667):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#wifi_iot(23667):    at android.os.Looper.loopOnce(Looper.java:226)
E/MethodChannel#wifi_iot(23667):    at android.os.Looper.loop(Looper.java:313)
E/MethodChannel#wifi_iot(23667):    at android.app.ActivityThread.main(ActivityThread.java:8663)
E/MethodChannel#wifi_iot(23667):    at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#wifi_iot(23667):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/MethodChannel#wifi_iot(23667):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/MethodChannel#wifi_iot(23667): Failed to handle method call
java.lang.IllegalArgumentException: Unsupported value: 'WIFI_AP_STATE_DISABLED' of type 'class info.whitebyte.hotspotmanager.WIFI_AP_STATE'
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:297)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:63)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:267)
E/MethodChannel#wifi_iot(23667):    at com.alternadom.wifiiot.WifiIotPlugin.getWiFiAPState(WifiIotPlugin.java:675)
E/MethodChannel#wifi_iot(23667):    at com.alternadom.wifiiot.WifiIotPlugin.onMethodCall(WifiIotPlugin.java:309)
E/MethodChannel#wifi_iot(23667):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#wifi_iot(23667):    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#wifi_iot(23667):    at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#wifi_iot(23667):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#wifi_iot(23667):    at android.os.Looper.loopOnce(Looper.java:226)
E/MethodChannel#wifi_iot(23667):    at android.os.Looper.loop(Looper.java:313)
E/MethodChannel#wifi_iot(23667):    at android.app.ActivityThread.main(ActivityThread.java:8663)
E/MethodChannel#wifi_iot(23667):    at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#wifi_iot(23667):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/MethodChannel#wifi_iot(23667):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/MethodChannel#wifi_iot(23667): Failed to handle method call
Doldrums commented 1 year ago

@daadu could u take a look

soniarojhwal commented 1 year ago

any update?

dzen1984 commented 1 year ago

any update?

susundberg commented 1 year ago

I also hit the very same issue

 % flutter doctor  
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.3, on Ubuntu 22.04.2 LTS 5.15.0-73-generic, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (2 available)
[✓] Network resources

And the same issue happened also on real android device when uploading the example APK.

phdinh94 commented 1 year ago

Same issue

daadu commented 1 year ago

Guys, this is AP functionality, which is broken from SDK 26 and above. The example app is out of date as long as AP functionality is concerned.

susundberg commented 1 year ago

I guess you know the best, to me the error code looked like the platform - communication failed for some mysterious reason; like it would not be able to encode the ENUM value of WIFI_AP_STATE_DISABLED

nuxwork commented 10 months ago

Same issue

nuxwork commented 10 months ago

original:

  private void getWiFiAPState(Result poResult) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
      poResult.success(moWiFiAPManager.getWifiApState().ordinal());
    } else {
      poResult.success(localOnlyHotspotState);
    }
  }

fixed:

  private void getWiFiAPState(Result poResult) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
      poResult.success(moWiFiAPManager.getWifiApState().ordinal());
    } else {
      poResult.success(localOnlyHotspotState.ordinal());
    }
  }
integraodessa commented 10 months ago

Android 12 API 35 nothing works example

fabioselau077 commented 9 months ago

Android 12 API 35 nothing works example

same here

isaaclkh commented 2 weeks ago

Is there any updates?