флаттер - используйте инструменты:overrideLibrary=io.flutter.plugins.camera

При реализации камеры во флаттере я сталкиваюсь с этой проблемой с файлом манифеста.

    android\app\src\main\AndroidManifest.xml Error:
        uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] D:\My Files\flutter-apps\login\build\camera\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml as the library might be using APIs not available in 16
        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="io.flutter.plugins.camera" 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 16 cannot be smaller than version 21 declared in library [:camera] D:\My Files\flutter-apps\login\build\camera\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml as the library might be using APIs not available in 16
        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)**strong text**

person Rakshith Rakshak    schedule 05.01.2019    source источник


Ответы (1)


Если вы хотите использовать подключаемый модуль камеры, вам необходимо обновить Flutter Android minSdkVersion до 21 в файле Android build.gradle, расположенном здесь:

./android/app/build.gradle

Вот как это должно быть:

 defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.my_flutter_app"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

Если вы посмотрите на страницу плагина, вы увидите, что они также говорят вам, что делать.

person shadowsheep    schedule 05.01.2019