简体   繁体   中英

Flutter cant import `flutter_webrtc.dart`

Why is it i cant import flutter_webrtc.dart ? this is the the documentation i followed 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

The error says

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

set the minSdkVersion to 21. You can find it inside build.gradle it will resolve your issue.

It need minSdkversion 21 change minSdkVersion=21 in app level build.gradle file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM