I am trying to get a private Cocoapods repo – VPTEngine – set up on the ios side of a Flutter Package I am building – vpt_engine_plugin.
I created the repo and pushed it, following these instructions… pod search VPTEngine
shows:
-> VPTEngine (0.0.1)
Performance Optimized Workings.
pod 'VPTEngine', '~> 0.0.1'
Homepage: http://github/VisualPT/VPTEngine
Source: https://github.com/VisualPT/VPTEngine.git
Versions: 0.0.1 [VPTEngine repo]
In the package path vpt_engine_plugin/ios/vpt_engine_plugin.podspec
, I add:
s.dependency 'VPTEngine', '0.0.1'
s.source = {
:git => "https://github.com/VisualPT/VPTEngine.git",
:tag => s.version.to_s
}
However, when I run pod install
in the project depending on this plugin, I get…
[!] Unable to find a specification for VPTEngine (= 0.0.1) depended upon by vpt_engine_plugin
It works when I add this in the vpt_engine_plugin/example/ios/Podfile
…
source 'https://github.com/VisualPT/VPTEngine.git'
source 'https://cdn.cocoapods.org/'
pod 'VPTEngine', '0.0.1'
But I dont see that being done for any of the other packages I currently depend on in my Flutter Application, which tells me that is not the correct way to do it.
My goal is to only have to add:
vpt_engine_plugin:
git:
url: https://github.com/VisualPT/vpt_engine_plugin.git
branch: master
to my project pubspec.yaml and have it connect to the VPTEngine pod without additional configuration within the project, as most other dependencies work?
2
Answers
The error message indicates that CocoaPods is unable to find a specification for VPTEngine version 0.0.1, which is a dependency specified by the vpt_engine_plugin. This can happen if the specified version or branch does not exist in the repository or if there is an issue with the CocoaPods repository.
Here are a few things you can check and try:
Check Repository and Version:
Verify that the branch or tag 0.0.1 exists in the repository. If not, use the correct branch or tag.
Ensure that your CocoaPods is up to date. Run the following commands in your terminal:
gem install cocoapods
pod repo update
Instead of specifying a version (0.0.1), try specifying a commit hash or a branch directly in your pubspec.yaml:
dependencies:
vpt_engine_plugin:
git:
url: https://github.com/VisualPT/vpt_engine_plugin.git
ref: master # Replace with the correct branch or commit hash
Verify that the repository contains a proper VPTEngine.podspec file with the correct version information.
Ensure that the URL of the Git repository is correct and accessible.
Yes I do, but this is the way i am using in recent project.
Let me explain you in detail
I have used like this in yaml file here is the code:
dependencies:
flutter:
sdk: flutter //you need to add this below this line
vpt_engine_plugin:
git:
url: https://github.com/VisualPT/vpt_engine_plugin.git
This is my yaml file looks like and do pod install after adding this then you can directly import in the dart file the package like this
import ‘package:vpt_engine_plugin/vpt_engine_plugin.dart’;
Be careful for the name you are providing here in yaml file "vpt_engine_plugin:"