androidflutterdart

Unable to build apk nor app bundle after flutter update


I'm getting the following error when I try to build my apk:

Execution failed for task ':assets_audio_player_web:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:C:\Users\lubya\.gradle\caches\transforms-3\ba0a6fe31cd4794ca72feaf033c059c8\transformed\core-1.13.1\res\values\values.xml:113:5-122:25: AAPT: error: resource android:attr/lStar not found.

I got a bunch of other errors which I managed to fix. I also changed my ext.kotlin_version in my build.gradle from 1.6.10 to 1.7.0 in case that is of any relevance.

Relevant lines in pubsec.yaml:

dependencies:
  flutter:
    sdk: flutter
  assets_audio_player: ^3.0.8

I tried to fix the other errors but this one never left. I expected to build the apk.


Solution

  • This error exists in 3.24+ versions of flutter. Based on reports, there are 2 possible ways to resolve it:

    1. Downgrade Flutter to 3.22. Will work because relevant Flutter framework patches didn't make it to 3.22, only to 3.24 and up. But, there is no reasons to believe that it will be fixed in newer versions, because fix should be done on plugin side, not Flutter.
    2. Based on this answer, this addition to build.gradle should work. Make sure, that you create separate subprojects block and do not add to existing one:
    subprojects {
        afterEvaluate { project ->
            if (project.plugins.hasPlugin("com.android.application") ||
                    project.plugins.hasPlugin("com.android.library")) {
                project.android {
                    compileSdkVersion 34
                }
            }
        }
    }