VNAPNIC/flutter_nearby_connections

Example not working [ANDROID]

Spad8 opened this issue · 11 comments

Spad8 commented

I'm trying out your plugin, but the example app doesn't seem to work at all.
I'm using two real devices, both showing the WiFi direct notification, but neither seeing the other.

This si my flutter doctor output:
flutter_doctor

I'm probably missing something, but I can't figure it out
Permissionas are set, too.

Spad8 commented

I tried on iOS simulators, and it's working just fine, just like the README gif.
I can't really get it

Tested, same not work on Android in real devices.

android if using wifi means using the hotspot, and will affect internet connection
android only supports Bluetooth
If you still want to use wifi with android you can refer to
https://github.com/VNAPNIC/UDP-TCP-Flutter

I tested this on Android devices as well, and I had the same result. The devices are not able to see each other.

@VNAPNIC Thanks for your answer.

I use exactly the same from your example project:

await nearbyService.init( serviceType: 'mpconn', deviceName: devInfo, strategy: Strategy.P2P_CLUSTER, callback: (isRunning) async { if (isRunning) { if (widget.deviceType == DeviceType.browser) { await nearbyService.stopBrowsingForPeers(); await nearbyService.startBrowsingForPeers(); } else { await nearbyService.stopAdvertisingPeer(); await nearbyService.startAdvertisingPeer(); await nearbyService.stopBrowsingForPeers(); await nearbyService.startBrowsingForPeers(); } } });

the Strategy.P2P_CLUSTER use Bluetooth, right? if yes, it doesn't work.

Same result here the plugin works perfectly with iOS but when testing it with an Android device the app even doesn't finish compiling and give the following errors

  1. class 'kotlin.unit' was compiled with an incompatible version of kotlin. the binary version of its metadata is 1.5.1, expected version is 1.1.16.
  2. execution failed for task ': "flutter_nearby_connections:" compiledebugkotlin'.
  1. class 'kotlin.unit' was compiled with an incompatible version of kotlin. the binary version of its metadata is 1.5.1, expected version is 1.1.16.
  2. execution failed for task ': "flutter_nearby_connections:" compiledebugkotlin'.

@Heshara I had to make a couple of changes to get the app to compile:

  • Update the Compile and Target SDK Versions to 30 in example/android/app/build.gradle
  • Update the kotlin version variable in example/android/build.gradle to a newer version (I used 1.4.32)
  • In the same file, update the version number at the end of the gradle dependency to use a newer version (I used 4.1.3)

This solved the incompatible version of kotlin error for me.

@smoore-edare thanks a lot it fixed the compilation error! Still Android devices are unable to identify each other

  1. class 'kotlin.unit' was compiled with an incompatible version of kotlin. the binary version of its metadata is 1.5.1, expected version is 1.1.16.
  2. execution failed for task ': "flutter_nearby_connections:" compiledebugkotlin'.

@Heshara I had to make a couple of changes to get the app to compile:

  • Update the Compile and Target SDK Versions to 30 in example/android/app/build.gradle
  • Update the kotlin version variable in example/android/build.gradle to a newer version (I used 1.4.32)
  • In the same file, update the version number at the end of the gradle dependency to use a newer version (I used 4.1.3)

This solved the incompatible version of kotlin error for me.

@VNAPNIC
I have still this issues problem in android oreo real device

Me too! Still not working in real android devices