6 / 6
Sep 2024

he issue below happen only when i am trying to build APK

FAILURE: Build failed with an exception.

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

A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed
ERROR: C:\Users\USER\AndroidStudioProjects\jamia\build\realm\intermediates\merged_res\release\mergeReleaseResources\values\values.xml:194: AAPT: error: resource android:attr/lStar not found.


<attr format="float" name="lStar"/> <attr name="android:lStar"/> <<<<< THIS IS THE POINT

[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.4717], locale en-US)
• Flutter version 3.24.0 on channel stable at C:\flutter\flutter
• Upstream repository GitHub - flutter/flutter: Flutter makes it easy and fast to build beautiful apps for mobile and beyond
• Framework revision 80c2e84975 (11 days ago), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2

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

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\Ahmad\AppData\Local\Android\Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\Users\Ahmad\AppData\Local\Android\Sdk
• ANDROID_SDK_ROOT = C:\Users\Ahmad\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.3.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.3.32901.215
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:

• Dart plugin can be installed from:

• android-studio-dir = C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] VS Code (version 1.92.1)
• VS Code at C:\Users\Ahmad\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.94.0

[√] Connected device (4 available)
• TECNO BF7n (mobile) • 096473733S004784 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4717]
• Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.89
• Edge (web) • edge • web-javascript • Microsoft Edge 120.0.2210.91

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

• No issues found!


setting.gradle

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file(“local.properties”).withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty(“flutter.sdk”)
assert flutterSdkPath != null, “flutter.sdk not set in local.properties”
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() }

}

plugins {
id “dev.flutter.flutter-plugin-loader” version “1.0.0”
id “com.android.application” version ‘8.3.2’ apply false
id “org.jetbrains.kotlin.android” version “1.9.23” apply false
}

include “:app”


gradle-wraooer.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-all.zip


app/build.gradle

lugins {
id “com.android.application”
id “kotlin-android”
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id “dev.flutter.flutter-gradle-plugin”
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file(“local.properties”)
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader(“UTF-8”) { reader →
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty(“flutter.versionCode”)
if (flutterVersionCode == null) {
flutterVersionCode = “1”
}

def flutterVersionName = localProperties.getProperty(“flutter.versionName”)
if (flutterVersionName == null) {
flutterVersionName = “1.0”
}

android {
namespace = “com.example.jamia”
compileSdk = 34
ndkVersion = “25.1.8937393”

compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.jamia" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdk = 23 targetSdk = 34 versionCode = flutterVersionCode.toInteger() versionName = flutterVersionName multiDexEnabled true } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.debug } }

}

flutter {
source = “…/…”
}


i deleted the .gradle but did not fix the issue, need help plz?

9 days later

I found this comment on Github, seems to be a relatively new issue. This worked for me:

The workaround does work.

However, would MongoDb please increase the compileSdk version to 31 in the next release? It’s currently sitting at 28. Then there will be no need for a workaround.

Less than 14% of users out there are running Android 11 (SDK <= 30) and less than 4% of users are using Android 9 (SDK v28).

Thanks!

-Shane

the best solution is to downgrade flutter of 3.24 to 3.23 or 3.22

this is flutter plugin bug