Closed Holofox closed 1 year ago
[!] CocoaPods could not find compatible versions for pod "media_kit_video":
In Podfile:
media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
... Error output from CocoaPods: ↳ media_kit: WARNING: package:media_kitlibs not found x client.h x render.h x render_gl.h x stream_cb.h media_kit: WARNING: package:media_kitlibs not found
=========
[✓] Flutter (Channel stable, 3.7.9, on macOS 13.3.1 22E261 darwin-arm64, locale en-IN) [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.1) [✓] VS Code (version 1.77.3) [✓] Connected device (3 available) [✓] HTTP Host Availability
Can you give us the version and location of pod
please?
$ readlink -f $(which pod)
/usr/local/Cellar/cocoapods/1.12.1/bin/pod
$ pod --version
1.12.1
On Android, the two shared libraries between media_kit & ffmpeg_kit_flutter seem to be conflicting in your case. Let's see if there's something that can be done, without requiring a specialized media_kitlibs*** package.
And also the current location:
$ pwd
ERROR: No pubspec.lock was found: ENV["PWD"] = "/"
In short, the podspec
in media_kit_native_event_loop
looks for the pubspec.lock
by recursively searching for it in the parent folders. The current folder seems invalid.
@birros,
++ which pod
+ readlink -f /usr/local/lib/ruby/gems/3.0.0/bin/pod
/usr/local/lib/ruby/gems/3.0.0/bin/pod
+ pod --version
1.12.0
++ pwd
+ echo /Users/runner/work/1/s
/Users/runner/work/1/s
@alexmercerind, I understand that in my case there is a dependency conflict with video_editor, which uses ffmpeg_kit_flutter_min_gpl. I'll think about what can be done, then this is not a problem with the media_kit
package.
@alexmercerind, based on https://github.com/arthenica/ffmpeg-kit/issues/721 and https://github.com/arthenica/ffmpeg-kit/issues/722, I was able to get around the problem, but I ran into another one https://github.com/arthenica/ffmpeg-kit/issues/461. A very interesting case.
packagingOptions {
// FFMpeg
pickFirst 'lib/**/libc++_shared.so'
pickFirst 'lib/**/libavcodec.so'
pickFirst 'lib/**/libswscale.so'
pickFirst 'lib/**/libavformat.so'
pickFirst 'lib/**/libavutil.so'
pickFirst 'lib/**/libavdevice.so'
pickFirst 'lib/**/libavfilter.so'
pickFirst 'lib/**/libswresample.so'
}
That is, I can't use ffmpeg_kit_flutter_min_gpl in my project.
MissingPluginException(No implementation found for method ffmpegSession on channel flutter.arthenica.com/ffmpeg_kit)]
For iOS, since you apparently use a CI, can you share the configuration file please?
FYI - the build succeeds for macOS as target, but fails for ios. Do you need any specific information that can help get to the issue?
For iOS, since you apparently use a CI, can you share the configuration file please?
I am using MS App Center, here is my application build process:
#!/usr/bin/env bash
# Fail if any command fails
set -ex
# Default values
PROJECT_DIR="$(dirname "$(pwd)")"
echo "##[section]: Install Flutter SDK"
mkdir ~/dev && cd "$_"
git clone -b 3.7.11 --depth 1 https://github.com/flutter/flutter.git
PATH="$(pwd)"/flutter/bin:$PATH
export PATH
echo "##[section]: Validate Flutter SDK"
flutter doctor
echo "##[section]: Go to project directory"
cd "$PROJECT_DIR"
echo "##[section]: Run code generators & build project"
flutter pub get packages
flutter packages pub run build_runner build --delete-conflicting-outputs
echo "##[section]: Start build"
flutter build ios --release -t ./lib/main.dart --no-codesign
That is, I can't use ffmpeg_kit_flutter_min_gpl in my project.
@alexmercerind, do you have any idea why the media_kit_libs_android_video affects ffmpeg_kit_flutter_min_gpl?
ffmpeg_kit_flutter_min_gpl: ^5.1.0
media_kit_libs_android_video: ^1.0.1
packagingOptions {
pickFirst 'lib/**/libc++_shared.so'
pickFirst 'lib/**/libavcodec.so'
pickFirst 'lib/**/libswscale.so'
pickFirst 'lib/**/libavformat.so'
pickFirst 'lib/**/libavutil.so'
pickFirst 'lib/**/libavdevice.so'
pickFirst 'lib/**/libavfilter.so'
pickFirst 'lib/**/libswresample.so'
}
When I call:
import 'package:ffmpeg_kit_flutter_min_gpl/ffmpeg_kit.dart';
FFmpegKit.execute('');
The following MissingPluginException was thrown while activating platform stream on channel flutter.arthenica.com/ffmpeg_kit_event:
MissingPluginException(No implementation found for method listen on channel flutter.arthenica.com/ffmpeg_kit_event)
I couldn't do anything to fix the issue and get them to work together. Separately, the dependencies work fine.
@Holofox I made some changes locally, I was able to get the two packages working together.
MissingPluginException
is raised because platform side implementation isn't being registered because to an UnsatisfiedLinkError
on Java/Kotlin side (you can see it in your logcat). If you check closely, you will notice this has caused none of the plugins to work.
package:ffmpeg_kit_flutter makes some modifications to it's FFmpeg e.g. for allowing usage with Storage Access Framework on Android. When using pickFirst
in your build.gradle
, the minimal variant of FFmpeg inside package:media_kit gets selected instead of package:ffmpeg_kit_flutter_min_gpl one, which causes that error to be thrown (due to missing export/function).
I will need some time since I'm currently busy with few things. Two solutions I can think of:
media_kit_libs_android_***
package for usage with package:ffmpeg_kit_flutter.pubspec.lock
to check presence of package:ffmpeg_kit_flutter & selecting *.jar
accordingly.Later solution will be bit tedious for me but better to the end users IMO.
You may chat with us on our Discord: https://discord.gg/h7qf2R9n57 ^^
If that's a way of conversation you prefer.
@alexmercerind, thanks for the explanation! It would be helpful to see any rough work that would even temporarily solve the problem.
@Holofox Can you explain me this command, it's the first time I see it:
$ flutter pub get packages
Expected to find project root in packages.
Is your repo multi packages?
But I can run this one:
$ flutter packages pub get
@Holofox,
A temporary solution:
Replace the files in your build/media_kit_libs_android_video
directory & comment following lines:
https://github.com/alexmercerind/media_kit/files/11342372/libs.zip
I can't reproduce, the build doesn't fail (macOS 13.3.1)
$ git clone -b 3.7.11 --depth 1 https://github.com/flutter/flutter.git
$ export PATH="$(pwd)"/flutter/bin:$PATH
$ flutter doctor
$ cd foo
$ flutter packages pub get # <-- replace `flutter pub get packages`
$ flutter packages pub run build_runner build --delete-conflicting-outputs
$ flutter build ios --release -t ./lib/main.dart --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.foo for device (ios-release)...
Running pod install... 2 730ms
Running Xcode build...
└─Compiling, linking and signing... 8,7s
Xcode build done. 17,1s
Built /Users/user/foo/build/ios/iphoneos/Runner.app.
$ ls build/ios/iphoneos/Runner.app/Frameworks
total 0
App.framework
Ass.framework
Avcodec.framework
Avfilter.framework
Avformat.framework
Avutil.framework
Crypto.framework
Flutter.framework
Freetype.framework
Fribidi.framework
Harfbuzz.framework
Mpv.framework
Ssl.framework
Swresample.framework
Swscale.framework
Tls.framework
Uchardet.framework
media_kit_libs_ios_video.framework
media_kit_native_event_loop.framework
media_kit_video.framework
Are you sure that no extra steps happens? Have you tried it locally before the CI?
@Holofox Can you explain me this command, it's the first time I see it:
Sorry, there is a typo in the command, it is executed as:
flutter pub get
Is your repo multi packages?
Is not
Are you sure that no extra steps happens?
I did not follow additional steps, I will try to find out more information about the problem.
Have you tried it locally before the CI?
I changed the command and it did not lead to a successful result. Locally the release version builds without any problems.
@sunilguptasg, do you have additional information on the issue?
I see two possibilities:
.flutter-plugins*
filesios
folder, possibly the PodfileTry :
$ rm -f .flutter-plugins* || true
$ cd ios && pod install
try :
$ rm -f ios/Podfile* || true
$ flutter create --platforms=ios .
$ sed -i '' 's/11.0/13.0/g' ios/Podfile
$ cd ios && pod install
@Holofox,
[Regarding Android] May you install media_kit_libs_android_video
like this & report back if it works?
dependencies:
...
media_kit_libs_android_video: ^1.0.3
[UPDATE]
@Holofox, the updated version should make your project build successfully with package:ffmpeg_kit_flutter:
Also, please update other packages too for improved stability (see in the README).
dependencies:
...
media_kit_libs_android_video: ^1.0.3
@alexmercerind, ffmpeg_kit_flutter_min_gpl worked, thanks!
@alexmercerind, I noticed that local videos work, but those that are downloaded from the network do not. Only black screen is shown, video is not loading.
I commented out this part in media_kit_test
:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
runApp(const MyApp(DownloadingScreen()));
// await prepareSources();
runApp(const MyApp(PrimaryScreen()));
}
And filled the list with links:
/// List of sample videos available for playback.
final sources = <String>[
'https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4',
'https://user-images.githubusercontent.com/28951144/229373709-603a7a89-2105-4e1b-a5a5-a6c3567c9a59.mp4',
'https://user-images.githubusercontent.com/28951144/229373716-76da0a4e-225a-44e4-9ee7-3e9006dbc3e3.mp4',
'https://user-images.githubusercontent.com/28951144/229373718-86ce5e1d-d195-45d5-baa6-ef94041d0b90.mp4',
'https://user-images.githubusercontent.com/28951144/229373720-14d69157-1a56-4a78-a2f4-d7a134d7c3e9.mp4',
];
And added a dependency:
ffmpeg_kit_flutter_min_gpl: ^5.1.0
@Holofox,
FFmpeg provided by package:ffmpeg_kit_flutter is now shared by package:media_kit. It greatly depends which features they enabled. Try using non *_min_gpl
variant which has http:// support.
You can share your experience if other variant of package:ffmpeg_kit_flutter works correctly with http:// URIs.
You can share your experience if other variant of package:ffmpeg_kit_flutter works correctly with http:// URIs.
@alexmercerind, i changed package to ffmpeg_kit_flutter_https_gpl
and it fixed my problem. 🎉
@birros,
- a problem with the
.flutter-plugins*
files
Didn't help fix the issue
2. a problem with a conf file in the
ios
folder, possibly the Podfile
I ran all the commands, but it didn't help
@birros, i can confirm that my script successfully finds the pubspec.lock
:
current_dir "/Users/runner/work/1/s/ios/.symlinks/plugins/media_kit_video/ios/media_kit_video.podspec"
Check path "/Users/runner/work/1/s/pubspec.lock"
File exist. Set pubspec_lock_path: "/Users/runner/work/1/s/pubspec.lock"
But then a command is launched from the MS App Center:
/usr/local/lib/ruby/gems/3.0.0/bin/pod install --repo-update
And the pwd
path changes to: /
2023-05-04T13:42:48.3140850Z ##[section]Starting: Pod install
2023-05-04T13:42:48.3158800Z ==============================================================================
2023-05-04T13:42:48.3158960Z Task : CocoaPods
2023-05-04T13:42:48.3159050Z Description : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
2023-05-04T13:42:48.3159230Z Version : 0.220.0
2023-05-04T13:42:48.3159310Z Author : Microsoft Corporation
2023-05-04T13:42:48.3159440Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
2023-05-04T13:42:48.3159570Z ==============================================================================
2023-05-04T13:42:48.6403340Z [command]/usr/local/lib/ruby/gems/3.0.0/bin/pod --version
2023-05-04T13:42:50.7883030Z 1.12.1
2023-05-04T13:42:50.7999290Z [command]/usr/local/lib/ruby/gems/3.0.0/bin/pod install --repo-update
2023-05-04T13:42:52.8624370Z Updating local specs repositories
2023-05-04T13:42:53.0222980Z Analyzing dependencies
2023-05-04T13:42:53.1283550Z make: Nothing to be done for `all'.
2023-05-04T13:42:53.1546170Z make: Nothing to be done for `all'.
2023-05-04T13:42:53.1562700Z current_dir "/Users/runner/work/1/s/ios/.symlinks/plugins/media_kit_video/ios/media_kit_video.podspec"
2023-05-04T13:42:53.1564190Z ERROR: No pubspec.lock was found: ENV["PWD"] = "/"
2023-05-04T13:42:53.1573980Z [!] Failed to load 'media_kit_video' podspec:
2023-05-04T13:42:53.1574770Z [!] Invalid `media_kit_video.podspec` file: ERROR: No pubspec.lock was found: ENV["PWD"] = "/".
2023-05-04T13:42:53.1574950Z
2023-05-04T13:42:53.1575230Z # from /Users/runner/work/1/s/ios/.symlinks/plugins/media_kit_video/ios/media_kit_video.podspec:27
2023-05-04T13:42:53.1575660Z # -------------------------------------------
2023-05-04T13:42:53.1575920Z # if pubspec_lock_path == ''
2023-05-04T13:42:53.1576120Z > abort(
2023-05-04T13:42:53.1576480Z # sprintf('ERROR: No pubspec.lock was found: ENV["PWD"] = "%s"', ENV['PWD'])
2023-05-04T13:42:53.1576870Z # -------------------------------------------
2023-05-04T13:42:53.1799300Z ##[error]The process '/usr/local/lib/ruby/gems/3.0.0/bin/pod' failed with exit code 1
2023-05-04T13:42:53.1811520Z ##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/3.0.0/bin/pod' failed with exit code 1
2023-05-04T13:42:53.1815310Z ##[section]Finishing: Pod install
And the pwd path changes to: "/Users/runner/work/1/s/ios/.symlinks/plugins/media_kit_video/ios/media_kit_video.podspec"
@Holofox Misinterpretation, the current_dir
is set to /Users/runner/work/1/s/ios/.symlinks/plugins/media_kit_video/ios/media_kit_video.podspec
, but the PWD
environment variable is set to /
, which is invalid, it should be /Users/runner/work/1/s
or /Users/runner/work/1/s/ios
.
I see three possibilities:
CocoaPods
task, as the PWD
env var seems to be wrong, and since Flutter itself runs a pod install
during the build if the iOS build folder is not present or if the pubspec
has been changedCocoaPods
task, and manually run pod install
command in the ios
folder of the applicationPWD
env variable with the path to the ios
folder when the CocoaPods
task is run, however I doubt this solution will work, I have not been able to do this locally when running pod install
In any case, there seems to be a problem with the CocoaPods
task in your CI, it might be relevant to open an issue on the appropriate platform.
If none of these solutions work, in the worst case, I can add to the podspec
code the fact to use a PWD_FALLBACK
env variable if no pubspec
was found with PWD
, which will need to be set in your pipeline.
I see three possibilities:
- Skip the
CocoaPods
task, as thePWD
env var seems to be wrong, and since Flutter itself runs apod install
during the build if the iOS build folder is not present or if thepubspec
has been changed- Replace the
CocoaPods
task, and manually runpod install
command in theios
folder of the application- Override the
PWD
env variable with the path to theios
folder when theCocoaPods
task is run, however I doubt this solution will work, I have not been able to do this locally when runningpod install
This can be implemented by migrating to Azure Pipelines, where you can change the configuration of CocoaPods@0. The limitation in this case is that we do not use it and remain within the functionality of the MS App Center.
In any case, there seems to be a problem with the
CocoaPods
task in your CI, it might be relevant to open an issue on the appropriate platform.
Microsoft rejects any problems related to unofficial custom application build methods. In this case, after executing a custom script, a script for native applications is run, which is useless for Flutter and you can't skip it.
And I also thought about getting around the problem with a symbolic link, but it didn't work out:
ln -s pubspec.lock /pubspec.lock
ln: /pubspec.lock: Read-only file system
If none of these solutions work, in the worst case, I can add to the
podspec
code the fact to use aPWD_FALLBACK
env variable if nopubspec
was found withPWD
, which will need to be set in your pipeline.
I think this is the only working solution that will help get around the problem. 🥲
Command:
Logs for iOS:
Command:
Logs for Android:
Flutter:
Dependencies: