Flutter:Android:使用音频播放器:^0.17.3 包生成错误,任务“:app:processDebugManifest”执行失败,构建失败

问题描述

我正在制作应用程序,其中按下按钮播放资产音频文件,早些时候它可以正常工作,但现在我不知道我的应用程序发生了什么,每当我在我的 phisical android 设备上运行应用程序时,它会生成错误,然后我在 pubspec.yaml 中将包的版本号从 ^0.17.0 更新到 ^0.17.3 但即使那样问题也是一样的,但是如果我从 pubspec.yaml 中删除 audioplayer 包行然后应用程序运行良好,应用程序会发生什么检查,还要检查我的 AndroidManifest.xml 文件代码错误后给出打击。谢谢

链接 https://pub.dev/packages/audioplayers

每次运行时都会出现以下错误

Launching lib\main.dart on SM M307F in debug mode...
 lib\main.dart
C:\Users\Anil\AndroidStudioProjects\newlightbulb\android\app\src\debug\AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [:audioplayers] C:\Users\Anil\AndroidStudioProjects\newlightbulb\build\audioplayers\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 23,or use tools:overrideLibrary="xyz.luan.audioplayers" 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 23 declared in library [:audioplayers] C:\Users\Anil\AndroidStudioProjects\newlightbulb\build\audioplayers\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 use tools:overrideLibrary="xyz.luan.audioplayers" 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 36s
Exception: Gradle task assembleDebug Failed with exit code 1
Exited (sigterm)

AndroidManifes.xml 文件中的代码

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.newflash">
    <!-- io.Flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startinitialization(this); in its onCreate method.
         In most cases you can leave this as-is,but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.Flutter.app.FlutterApplication"
        android:label="newflash"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singletop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that,this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <Meta-data
              android:name="io.Flutter.embedding.android.normalTheme"
              android:resource="@style/normalTheme"
              />
            <!-- displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame,then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <Meta-data
              android:name="io.Flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the Meta-data below.
             This is used by the Flutter tool to generate GeneratedpluginRegistrant.java -->
        <Meta-data
            android:name="FlutterEmbedding"
            android:value="2" />
    </application>
</manifest>

解决方法

尝试使用音频播放器:^0.10.0

,

Audioplayer 0.17.0 版本存在 sdk 兼容性问题

只需降级到音频播放器:^0.16.1

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...