flutter - 使用工具:overrideLibrary =“io.flutter.plugins.camera”

问题描述 投票:0回答:1

虽然在颤动中实现相机,但我面临清单文件的这个问题

    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个回答
0
投票

如果你想使用相机插件,你需要在你的android minSdkVersion文件中更新你的Flutter Android 21build.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"
    }

如果你看看plugin page,你会发现他们也会告诉你该怎么做。

© www.soinside.com 2019 - 2024. All rights reserved.