WiFiFlutter icon indicating copy to clipboard operation
WiFiFlutter copied to clipboard

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

Open Doldrums opened this issue 2 years ago • 12 comments

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 avatar Nov 19 '22 14:11 Doldrums

@daadu could u take a look

Doldrums avatar Nov 19 '22 14:11 Doldrums

any update?

soniarojhwal avatar Feb 06 '23 17:02 soniarojhwal

any update?

dzen1984 avatar Jun 15 '23 06:06 dzen1984

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.

susundberg avatar Jun 15 '23 07:06 susundberg

Same issue

phdinh94 avatar Jun 20 '23 16:06 phdinh94

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.

daadu avatar Jun 22 '23 08:06 daadu

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

susundberg avatar Jun 22 '23 09:06 susundberg

Same issue

nuxwork avatar Nov 06 '23 11:11 nuxwork

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());
    }
  }

nuxwork avatar Nov 06 '23 16:11 nuxwork

Android 12 API 35 nothing works example

integraodessa avatar Nov 15 '23 13:11 integraodessa

Android 12 API 35 nothing works example

same here

fabioselau077 avatar Jan 04 '24 23:01 fabioselau077