Tau: flutter_ffmpeg dependency, min sdk 24

Created on 2 Apr 2020  Â·  17Comments  Â·  Source: Canardoux/tau

Version 3.1.1

The library has a dependency with flutter_ffmpeg but this raises the min SDK version to 24.
Is it really necessary to use the full version of flutter_ffmpeg?
I see that exists the LTS version that decreases the min sdk version to 16.

maybe bug

All 17 comments

Your minSdkVersion problem is because you use the ffmpeg audio module.
If you want a minSdkVersion < 24, just replace the ffmpeg module by audio-lts in your build.gradle.

ext.flutterFFmpegPackage = 'audio-lts'

flutter_sound does not need the full version of ffmpeg. audio-lts is OK.
just replace the ffmpeg module by audio-lts in your build.gradle.

ext.flutterFFmpegPackage = 'audio-lts'

I am getting:

[!] CocoaPods could not find compatible versions for pod "flutter_ffmpeg":
  In Podfile:
    flutter_ffmpeg (from `.symlinks/plugins/flutter_ffmpeg/ios`)

Specs satisfying the `flutter_ffmpeg (from `.symlinks/plugins/flutter_ffmpeg/ios`)` dependency were found, but they required a higher minimum deployment target.

Actually Apple wants that new Apps are built with iOS 12 SDK until July.
After July we will have to use iOS 13 SDK.

flutter_sound does not need the full version of ffmpeg. audio-lts is OK.
just replace the ffmpeg module by audio-lts in your build.gradle.

ext.flutterFFmpegPackage = 'audio-lts'

Can you provide some more details. My build.gradle doesn't have a line ext.flutterFFmpegPackage so I'm not certain where to put the line?

We added a mention in the README to precise that this line can be put everywhere, perhaps at the beginning of the file, or the end.

Please be free to re-open this issue if you think that it has not been solved.

I'm still having problems with this one.

I've added the ext clause to the end of my gradle but I still get the same error:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
/home/bsutton/git/squarephone/android/app/src/debug/AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 18 cannot be smaller than version 24 declared in library [:flutter_ffmpeg] /home/bsutton/git/squarephone/build/flutter_ffmpeg/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 18
    Suggestion: use a compatible library with a minSdk of at most 18,
        or increase this project's minSdk version to at least 24,
        or use tools:overrideLibrary="com.arthenica.flutter.ffmpeg" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 18 cannot be smaller than version 24 declared in library [:flutter_ffmpeg] /home/bsutton/git/squarephone/build/flutter_ffmpeg/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 18
    Suggestion: use a compatible library with a minSdk of at most 18,
        or increase this project's minSdk version to at least 24,
        or use tools:overrideLibrary="com.arthenica.flutter.ffmpeg" to force usage (may lead to runtime failures)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Gradle task assembleDebug failed with exit code 1

build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "app.myapp.myapp"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true // needed for firestore
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation 'com.google.firebase:firebase-messaging:20.1.0'
}

apply plugin: 'com.google.gms.google-services'


ext.flutterFFmpegPackage  ='audio-lts'

OK

I've reported this issue on flutter-ffmpeg as it seems like an issue with their package.

https://github.com/tanersener/flutter-ffmpeg/issues/123

@bsutton :
I investigate this bug a bit more.
Could you try to put the line :

ext.flutterFFmpegPackage  ='audio-lts'

on top of yourApp/android/build.gradle and eventually remove this line from yourApp/android/app/build.gradle ?

Your problem is probably solved, by putting the correct line in yourApp/android/build.gradle.

But my feeling is that too many developers have too many problems with this flutter_ffmpeg dependency.
Actually there is only two places where we need flutter_ffmpeg :

  • To evaluate the duration of a record
  • To encode OGG/OPUS on iOS

But my plan is to use this plugin intensively in the future to record MP3, OPUS on Android, ...

I see two ways to get rid of flutter_ffmeg :

  • Link the app with a flutter_ffmpeg fork specially built with all the correct options (audio-lts).
  • Do not use flutter_ffmpeg at the dart level, but link the iOS plugin and the Android plugin directely with ffmpeg.

The second solution will be better when we will want to use lame to record MP3, because we will not need to pass the audio data from the native plugin to Dart/Flutter, and then from Dart/Flutter to flutter_ffmpeg. So it will be less CPU eating.
But I worry that flutter_sound will be too big.

Not keen on the fork idea as we need to maintain the fork.

On the flip side calling the code from Java Swift also makes the code
harder to maintain.

I don't understand your concern about plugin size?

What if we only supported a single codec in the core package. If people
want other codecs then they can link their preferred conversion package.

This is possibly an issue with streaming but we could have a callback that
passed a array for conversion as it arrives.

This keeps the code simple and the package small.

Firm side is possibly performance and convenience. We could publish a
couple of conversion packages based on common use cases.

On Sat, 11 Apr 2020, 9:06 pm Larpoux, notifications@github.com wrote:

Your problem is probably solved, by putting the correct line in
yourApp/android/build.gradle.

But my feeling is that too many developers have too many problems with
this flutter_ffmpeg dependency.
Actually there is only two places where we need flutter_ffmpeg :

  • To evaluate the duration of a record
  • To encode OGG/OPUS on iOS

But my plan is to use this plugin intensively in the future to record MP3,
OPUS on Android, ...

I see two ways to get rid of flutter_ffmeg :

  • Link the app with a flutter_ffmpeg fork specially built with all the
    correct options (audio-lts).
  • Do not use flutter_ffmpeg at the dart level, but link the iOS plugin
    and the Android plugin directely with ffmpeg.

The second solution will be better when we will want to use lame to
record MP3, because we will not need to pass the audio data from the native
plugin to Dart/Flutter, and then from Dart/Flutter to flutter_ffmpeg. So it
will be less CPU eating.
But I worry that flutter_plugin will be too big.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/265#issuecomment-612394563,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32ODNCIQPYV6ZYWWILKLRMBFKZANCNFSM4L2B6PYA
.

I have the impression that there is two kind of flutter_sound developers :

  • Those who wants a very simple plugin, easy to maintain. A plugin which does not do everything, but do those things correctly and easily.
  • Those who wants a plugin which does what the App need, without bothering with other things like threads, streams, format conversion, ... and without dealing with other libraries like flutter_ffmpeg.

The plugin size is just something that I will need to see later : last time I tried to publish flutter_sound I got an error from Flutter Pub, saying that my plugin was too big.
It is surprising, because I think that flutter_sound is very simple and light.
I will look to that in a few days when I will take care of your Pull Request. Now, I have no time left.

The idea of two packages could address the issue of two types of developer.

A base package that doesn't include ffmpg and a full package that does.

Otherwise can flutter sound not set the gradle flag so we only ship auto-lts

On Sat, 11 Apr 2020, 11:37 pm Larpoux, notifications@github.com wrote:

I have the impression that there is two kind of flutter_sound developers :

  • Those who wants a very simple plugin, easy to maintain. A plugin
    which does not do everything, but do those things correctly and easily.
  • Those who wants a plugin which does what the App need, without
    bothering with other things like threads, streams, format conversion, ...
    and without dealing with other libraries like flutter_ffmpeg.

The plugin size is just something that I will need to see later : last
time I tried to publish flutter_sound I got an error from Flutter Pub,
saying that my plugin was too big.
It is surprising, because I think that flutter_sound is very simple and
light.
I will look to that in a few days when I will take care of your Pull
Request. Now, I have no time left.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/265#issuecomment-612423059,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OG256N4NDBGBM22ZV3RMBXARANCNFSM4L2B6PYA
.

I investigate this bug a bit more.
Could you try to put the line :

ext.flutterFFmpegPackage  ='audio-lts'

on top of yourApp/android/build.gradle and eventually remove this line from yourApp/android/app/build.gradle ?

OK, that fixed the problem.
Thanks.

Please, feel free to reopen this issue if you think it has not be addressed properly.

Was this page helpful?
0 / 5 - 0 ratings