【问题标题】:flutter - use tools:overrideLibrary="io.flutter.plugins.camera"颤振 - 使用工具:overrideLibrary="io.flutter.plugins.camera"
【发布时间】:2019-01-05 19:26:22
【问题描述】:

在颤振中实现相机时,我在清单文件中遇到了这个问题

    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**

【问题讨论】:

    标签: flutter flutter-dependencies


    【解决方案1】:

    如果你想使用相机插件,你需要在你的 android build.gradle 文件中将你的 Flutter Android minSdkVersion 更新为 21

    ./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"
        }
    

    如果您查看plugin page,您可以看到他们也告诉您该怎么做。

    【讨论】:

      猜你喜欢
      • 2020-04-19
      • 2016-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多