On `Podfile`:
```ruby
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'OCProject' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for OCProject
# install_all_flutter_pods(flutter_application_path)
# install_flutter_engine_pod(flutter_application_path)
# install_flutter_application_pod(flutter_application_path)
install_flutter_plugin_pods(flutter_application_path)
end
post_install do |installer|
flutter_post_install(installer)
end
```
Encountering the following error after executing `pod install`:
```shell
pod install
[!] Invalid `Podfile` file: undefined method `flutter_relative_path_from_podfile' for #<Pod::Podfile:0x000000010e74c520 @defined_in_file=#<Pathname:/Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile>, @internal_hash={}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>
relative = flutter_relative_path_from_podfile(export_script_directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
# from /Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile:17
# -------------------------------------------
# # install_flutter_plugin_pods(flutter_application_path)
> install_flutter_application_pod(flutter_application_path)
#
# -------------------------------------------
```
The `flutter_relative_path_from_podfile` method is in `flutter_tools/bin/podhelper.rb`, but now `flutter_tools/bin/podhelper.rb` is only required in `install_all_flutter_pods` in `podhelper.rb.tmpl`.
Sometimes we only need to use the `install_flutter_plugin_pods` method in podhelper.rb. For example, using `Shorebird` in an iOS hybird app scenario, we need to build `Flutter.xcframework` and `App.xcframework` and embed them into the iOS native project. In order to avoid unnecessary conflicts, use `install_flutter_plugin_pods` method to install Flutter plugin pods.
[Shorebird - Code Push In Hybrid Apps](https://docs.shorebird.dev/guides/hybrid-app/ios)
So I adjust the position of `require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)`.
Templates for Flutter Module
common
Written to root of Flutter application.
Adds Dart project files including pubspec.yaml.
android
library
Written to the .android/ hidden folder.
Contents wraps Flutter/Dart code as a Gradle project that defines an Android library.
Executing ./gradlew flutter:assembleDebug in that folder produces
a .aar archive.
Android host apps can set up a dependency to this project to consume Flutter views.
gradle
Written to .android/ or android/.
Mixin for adding Gradle boilerplate to Android projects.
host_app_common
Written to either .android/ or android/.
Contents define a single-Activity, single-View Android host app
with a dependency on the .android/Flutter library.
Executing ./gradlew app:assembleDebug in the target folder produces
an .apk archive.
Used with either android_host_ephemeral or android_host_editable.
host_app_ephemeral
Written to .android/ on top of android_host_common.
Combined contents define an ephemeral (hidden, auto-generated,
under Flutter tooling control) Android host app with a dependency on the
.android/Flutter library.
host_app_editable
Written to android/ on top of android_host_common.
Combined contents define an editable (visible, one-time generated,
under app author control) Android host app with a dependency on the
.android/Flutter library.
ios
library
Written to the .ios/Flutter hidden folder.
Contents wraps Flutter/Dart code for consumption by an Xcode project.
iOS host apps can set up a dependency to this contents to consume Flutter views.
host_app_ephemeral
Written to .ios/ outside the Flutter/ sub-folder.
Combined contents define an ephemeral (hidden, auto-generated,
under Flutter tooling control) iOS host app with a dependency on the
.ios/Flutter folder contents.
The host app does not make use of CocoaPods, and is therefore suitable only when the Flutter part declares no plugin dependencies.
host_app_ephemeral_cocoapods
Written to .ios/ on top of host_app_ephemeral.
Adds CocoaPods support.
Combined contents define an ephemeral host app suitable for when the Flutter part declares plugin dependencies.