颤振无法导入`flutter_webrtc.dart`

Posted

技术标签:

【中文标题】颤振无法导入`flutter_webrtc.dart`【英文标题】:Flutter cant import `flutter_webrtc.dart` 【发布时间】:2021-02-17 05:06:39 【问题描述】:

为什么我无法导入flutter_webrtc.dart?这是我关注的文档https://pub.dev/packages/flutter_webrtc

home.dart

import 'package:flutter_webrtc/flutter_webrtc.dart';

pubspec.yaml

dependencies:
  http: ^0.12.2
  flutter_section_table_view: ^1.0.3
  page_transition: ^1.1.7+6
  path_provider: ^1.6.24
  cupertino_icons: ^1.0.0
  flutter_webrtc: ^0.5.8
  flutter:
    sdk: flutter

错误提示

C:\Users\Users\androidStudioProjects\TossGame\android\app\src\debug\AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:flutter_webrtc] C:\Users\Users\AndroidStudioProjects\TossGame\build\flutter_webrtc\intermediates\library_manifest\debug\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="com.cloudwebrtc.webrtc" 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 [:flutter_webrtc] C:\Users\Users\AndroidStudioProjects\TossGame\build\flutter_webrtc\intermediates\library_manifest\debug\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="com.cloudwebrtc.webrtc" 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 18s
Exception: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

@JanviPatel 我已经投票了 那是我的 【参考方案1】:

minSdkVersion 设置为21。您可以在build.gradle 中找到它,它将解决您的问题。

【讨论】:

是的,您可以查看您的环聊消息框。【参考方案2】:

需要minSdkversion 21 改变app级build.gradle文件中的minSdkVersion=21

【讨论】:

以上是关于颤振无法导入`flutter_webrtc.dart`的主要内容,如果未能解决你的问题,请参考以下文章

颤振导入随机停止工作,没有明显的原因

无法导入字体系列

信用卡扫描仪 - 颤振

如果您的项目有 dart html 导入,如何在模拟器上运行颤振

颤振导入'package:flutter_svg/flutter_svg.dart';不适用于 VS 代码和 Android 工作室

无法运行颤振命令