返回

Flutter: Understanding the Error "The 'Pods- такой' target has transitive dependencies that include statically linked binaries"

IOS

The "The 'Pods- такой' target has transitive dependencies that include statically linked binaries" error occurs when building Flutter projects using CocoaPods on macOS. This error arises due to a conflict between the dynamic linking mechanism used by Flutter and the static linking of certain dependencies introduced by CocoaPods.

To resolve this issue, you can follow these steps:

  1. Update CocoaPods: Ensure that you have the latest version of CocoaPods installed. Run pod update in your terminal to update CocoaPods.

  2. Remove Static Libraries: Identify the static libraries that are causing the conflict. To do this, open the Podfile.lock file in your project directory and look for lines that include static_framework or static_library.

  3. Modify Podfile: Remove the static libraries from your Podfile. For example, if you find static_framework 'GoogleUtilities' in the Podfile.lock file, add exclude_transitive_dependencies: 'GoogleUtilities' to your Podfile.

  4. Run pod install: Run pod install in your terminal to reinstall the CocoaPods dependencies with the modifications.

  5. Clean and Rebuild: Clean and rebuild your Flutter project by running flutter clean and flutter run in your terminal.

Here is an example of how you can modify your Podfile to exclude the static library causing the conflict:

target 'Runner' do
  # ... existing code ...
  pod 'GoogleUtilities', exclude_transitive_dependencies: 'GoogleUtilities'
  # ... additional pods ...
end

If the issue persists, you may need to manually remove the static libraries from the Pods/ directory in your project. To do this, navigate to the Pods/ directory and delete the .a files (static library archives) that correspond to the problematic libraries.

After making these changes, clean and rebuild your Flutter project. The error should now be resolved.

Additional Tips:

  • If you are using a third-party plugin or library that is causing the conflict, you may need to contact the developer of that plugin or library for support.
  • Consider using a different dependency management tool, such as Flutter's own package manager pub.
  • If you are still unable to resolve the issue, you can create a new Flutter project and migrate your code gradually to avoid potential conflicts.