Issue
I have a problem that when I run the application on flutter, it gives me this error in the terminal
what i want to do is to scan the nearest bluetooth device, get the uuid and node from that device then control it example: control light
FAILURE: Build failed with an exception.
Where:
Build file 'C:%user%\flutter.pub-cache\hosted\pub.dartlang.org\nordic_nrf_mesh-0.12.0\android\build.gradle' line: 44
What went wrong:
A problem occurred evaluating project ':nordic_nrf_mesh'.
Project with path ':mesh' could not be found in project ':nordic_nrf_mesh'.
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
the line 44 was come from the nordic_nrf_mesh library in my C:%user%\flutter.pub-cache\hosted\pub.dartlang.org\nordic_nrf_mesh-0.12.0\android\build.gradle
i don't know how to fix it
all i want to do is use the nordicNrfMesh.scanForUnprovisionedNodes
here is my function to scan
Future<void> _scanUnprovisionned() async {
_serviceData.clear();
setState(() {
_devices.clear();
});
widget.nordicNrfMesh.scanForUnprovisionedNodes().listen((event) {});
_scanSubscription =
widget.nordicNrfMesh.scanForUnprovisionedNodes().listen((device) async {
if (_devices.every((d) => d.id != device.id)) {
final deviceUuid = Uuid.parse(
getDeviceUuid(device.serviceData[meshProvisioningUuid]!.toList()));
debugPrint('deviceUuid: $deviceUuid');
debugPrint('deviceName: ${device.name}');
debugPrint('deviceDeviceId: ${device.id}');
debugPrint('deviceManfac: ${device.manufacturerData.toString()}');
debugPrint('deviceRssi: ${device.rssi.toString()}');
_serviceData[device.id] = deviceUuid;
_devices.add(device);
setState(() {});
}
});
setState(() {
isScanning = true;
});
return Future.delayed(const Duration(seconds: 10)).then((_) => _stopScan());
}
here is my build.gralde
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 32
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.dienquang.flutter_nrfmesh_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 23
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
i also add the Android-nRF-Mesh-Library file to my flutter
Pls help me
Solution
UPDATE: i open an issue on github and got the awswer now it work fine for me
https://github.com/OZEO-DOOZ/nrf_mesh_plugin/issues/249
did should to the trick for anyone stuck it this error
Answered By - Hưng Nguyễn
Answer Checked By - Candace Johnson (JavaFixing Volunteer)