skip to Main Content

every time i try to build my app i get this error

Running Gradle task ‘assembleRelease’…

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:flutter_native_image:verifyReleaseResources’.

A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed
ERROR:G:shakawasystembuildflutter_native_imageintermediatesmerged_resreleasevaluesvalues.xml:194: AAPT: error: resource android:attr/lStar not found.

  • 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.

BUILD FAILED in 17s
Running Gradle task ‘assembleRelease’… 18.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1

this is my flutter doctor
flutter doctor -v
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.19045.4894], locale en-US)
• Flutter version 3.24.3 on channel stable at G:Flutter filesflutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (12 days ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain – develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:Usersyosf3AppDataLocalAndroidsdk
• Platform android-35, build-tools 35.0.0
• Java binary at: G:Android Studiojbrbinjava
• Java version OpenJDK Runtime Environment (build 17.0.10+0–11609105)
• All Android licenses accepted.

[√] Chrome – develop for the web
• Chrome at C:Program FilesGoogleChromeApplicationchrome.exe

[X] Visual Studio – develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.1)
• Android Studio at G:Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0–11609105)

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4894] • Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.59
• Edge (web) • edge • web-javascript • Microsoft Edge 129.0.2792.52

[√] Network resources
• All expected network resources are available.

! Doctor found issues in 1 category.

2

Answers


  1. Gradle is telling you the answer. In the failure output you pasted, this line has the important piece.

    "G:shakawasystembuildflutter_native_imageintermediatesmerged_resreleasevaluesvalues.xml:194: AAPT: error: resource android:attr/lStar not found."

    Specifically the resource of android:attr/lStar not found is not found. This looks to be a failure in the flutter_native_image package. Unfortunately it looks like this project is discontinued.

    If you are looking to resize images you can check out this website as a potential option.

    Login or Signup to reply.
  2. The error you’re encountering (resource android:attr/lStar not found) is related to a compatibility issue between the Flutter package flutter_native_image and the Android SDK version or the Gradle setup you’re using.

    See some steps you can follow to resolve the issue, I’ll break it down

    1. Update compileSdkVersion and targetSdkVersion

    • This error often occurs when the SDK versions in your
      android/app/build.gradle are lower than the required version. Update
      the compileSdkVersion and targetSdkVersion to 33 or higher.
      See an example here, in your android/app/build.gradle, update this:
    android {
        compileSdkVersion 33
        defaultConfig {
            targetSdkVersion 33
        }
    }

    2. Update the Gradle Plugin and Wrapper

    • Ensure you’re using the latest version of the Gradle plugin and
      wrapper. Update the android/build.gradle file:
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.0'
    }

    Also, make sure your gradle-wrapper.properties file has the latest Gradle version:

    distributionUrl=https://services.gradle.org/distributions/gradle-8.1-all.zip

    3. Clean and Rebuild the Project

    • After updating, make sure you run the following commands to clean and
      rebuild the project and see the result:
    flutter clean
    flutter pub get

    Then, try building again:

    flutter build apk --release

    4. Check for Dependencies

    • Sometimes dependencies might not be compatible with the latest SDK
      versions. Ensure that the flutter_native_image package you’re
      using is up to date. If the issue persists, you might look for an
      alternative package or consider checking the open issues on the
      flutter_native_image GitHub repository.

      Link: https://github.com/btastic/flutter_native_image.git

    5. Check for Specific Android Version in Packages

    • If flutter_native_image is not actively maintained or has
      compatibility issues with SDK 33+, consider adding the following to
      android/build.gradle to ignore certain issues:
    android {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }

    6. Review Flutter Plugin Version

    • Ensure that your Flutter SDK and its plugins are up to date by
      running:
    flutter upgrade

    Try applying these changes, you should be able to resolve the build failure you’re encountering. Let me know if you need further assistance!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search