flutter_nearby_connections icon indicating copy to clipboard operation
flutter_nearby_connections copied to clipboard

Example not working [ANDROID]

Open Spad8 opened this issue 3 years ago • 11 comments

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 avatar May 25 '21 07:05 Spad8

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

Spad8 avatar May 25 '21 08:05 Spad8

Tested, same not work on Android in real devices.

abedputra avatar Jun 13 '21 01:06 abedputra

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

VNAPNIC avatar Jun 14 '21 03:06 VNAPNIC

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

smoore-edare avatar Jun 14 '21 15:06 smoore-edare

@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.

abedputra avatar Jun 15 '21 00:06 abedputra

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'.

Heshara avatar Jun 15 '21 13:06 Heshara

  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 avatar Jun 15 '21 14:06 smoore-edare

@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.

Heshara avatar Jun 16 '21 08:06 Heshara

Fixed on version 1.1.0 https://github.com/VNAPNIC/flutter_nearby_connections/releases/tag/1.1.0

VNAPNIC avatar Jun 17 '21 07:06 VNAPNIC

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

JAICHANGPARK avatar Aug 27 '21 02:08 JAICHANGPARK

Me too! Still not working in real android devices

pmahdicheraghi avatar Mar 25 '22 08:03 pmahdicheraghi