Execution failed for task ':flutter_plugin3:generateJsonModelDebug'. > C:\Users\Mubin\AndroidStudioProjects\flutter_plugin3\android\CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at C:\Users\Mubin\AndroidStudioProjects\flutter_plugin3\android\CMakeLists.txt:3 (add_library): Cannot find source file: hello.c Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx * 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.
cmake_minimum_required(VERSION 3.7 FATAL_ERROR) project(hello_library VERSION 1.0.0 LANGUAGES C) add_library(hello_library SHARED hello.c hello.def) add_executable(hello_test hello.c) set_target_properties(hello_library PROPERTIES PUBLIC_HEADER hello.h VERSION ${PROJECT_VERSION} SOVERSION 1 OUTPUT_NAME "hello" XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Hex_Identity_ID_Goes_Here" )
import 'dart:ffi' as ffi; import 'dart:io' show Platform, Directory; import 'package:path/path.dart' as path; // For Platform.isX import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; class FlutterPlugin3 { static const MethodChannel _channel = const MethodChannel('flutter_plugin3'); static Future<String> get platformVersion async { final String version = await _channel.invokeMethod('getPlatformVersion'); return version; } } // Open the dynamic library typedef hello_world_func = ffi.Void Function(); // Dart type definition for calling the C foreign function typedef HelloWorld = void Function(); greet() { // Open the dynamic library var libraryPath = path.join(Directory.current.path, 'hello_library', 'libhello.so'); if (Platform.isMacOS) { libraryPath = path.join(Directory.current.path, 'hello_library', 'libhello.dylib'); } else if (Platform.isWindows) { libraryPath = path.join(Directory.current.path, 'hello_library', 'Debug', 'hello.dll'); } final dylib = ffi.DynamicLibrary.open(libraryPath); // Look up the C function 'hello_world' final HelloWorld hello = dylib .lookup<ffi.NativeFunction<hello_world_func>>('hello_world') .asFunction(); // Call the function hello(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)