The error is:
Failed to load ‘lexactivator’ podspec:
[!] Invalid lexactivator.podspec file: undefined method `library’ for #<Pod::Specification name=“lexactivator”>
I’ve tried changing:
s.library ‘…/’
to this:
s.library = ‘…/’
…and get a different error:
ld: library not found for -l…/
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
I’m not sure what the appropriate value is for library, but as it comes from pub.dev, it appears to be invalid. I also tried removing that line altogether as well but get errors that way too.
This is a Flutter 3.3.1 app with Dart 2.18.0 on MacOS. Any help is appreciated.
The lexactivator package on pub.dev is an initial version that we shipped for Windows and Linux, which is why it does not contain the library that the project requires for macOS. Currently, you can add the required library for macOS by following these steps:
Download the latest LexActivator library (non-static) for macOS from Dashboard->Downloads. Alternatively, you can use this link.
Extract the zip file and within the extracted folder, the library you require is a file named libLexActivator.dylib which will be found in EXTRACTED_FOLDER/libs/clang/universal.
In your Flutter project, Open the yourapp/macos/Runner.xcworkspace in Xcode.
Drag (libLexActivator.dylib) into Runner/Frameworks.
Click Runner and go to the Build Phases tab.
1. Drag libLexActivator.dylib into the Copy Bundle Resources list.
2. Under Embed Libraries (if available), check Code Sign on Copy.
3. Under Link Binary With Libraries, set status to Optional.
Click Runner and go to the General tab.
1. Drag libLexActivator.dylib into the Frameworks, Libraries and Embedded Content list.
2. Select Embed & Sign.
This should be enough for you to get started with using the lexactivator package on macOS.
I assure you that future versions of the lexactivator package will not require this cumbersome process and we shall add support for macOS in the near future.
After adding the library to your project by following the steps above, you can use the lexactivator package as per the tutorial in the readme.
You do not need to install the package locally using the path: method of importing in the pubspec. Furthermore, you will not need to make any changes to the podspec in the lexactivator package.
Maybe I’m missing something. I followed the steps in XCode; however, the lexactivator.podspec file in the Dart library is still invalid. I get the same error when running the Flutter app:
-> Fetching podspec for `lexactivator` from `Flutter/ephemeral/.symlinks/plugins/lexactivator/macos`
[!] Failed to load 'lexactivator' podspec:
[!] Invalid `lexactivator.podspec` file: undefined method `library' for #<Pod::Specification name="lexactivator">
Did you mean? library=.
# from /Users/blakemiller/myapp/macos/Flutter/ephemeral/.symlinks/plugins/lexactivator/macos/lexactivator.podspec:18
# -------------------------------------------
# s.dependency 'FlutterMacOS'
# s.library '../'
#
# -------------------------------------------
Should I expect that adding the library in XCode will address the invalid podspec?