Closed sonuPrasas010 closed 2 months ago
Same here. It stopped working since latest Flutter upgrade. Works in debug mode but not in release.
Post both your gradle files.
nobody is specifying what version of the plug-in they’re using.
build.gradle:
allprojects {
repositories {
google()
jcenter()
maven { url "${project(':background_fetch').projectDir}/libs" }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Using latest plugin version and latest Flutter version.
First-of-all, the maven repo jcenter() has been deprecated since 2021.
second, you’ve not fully implemented the Android setup instructions linked in the readme (the ext
vars).
I suggest you generate a fresh hello-world app and compare the changes in the default build.gradle with those in your own app.
you’ve failed to properly upgrade your app with the latest requirement of the latest flutter SDK. That’s why you have problems.
I am getting same issue [BUG] AAPT: error: resource android:attr/lStar not found. This my bulid.gradle file
allprojects { repositories { google() mavenCentral() maven { url "${project(':background_fetch').projectDir}/libs" } } }
rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') }
tasks.register("clean", Delete) { delete rootProject.buildDir }
See my comment above: https://github.com/transistorsoft/flutter_background_fetch/issues/369#issuecomment-2119292134
you did not fully implement the Setup Instructions (ext
vars). Go back and review the Setup Instructions. Yes, they are important.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I just have added below ext
code in android/build.gradle
after allprojects{}
, and use them in android/app/build.gradle
as the presentation of the help doc Android Setup, it has solved the problem on my side.
allprojects {
...
}
ext {
compileSdkVersion = 34
targetSdkVersion = 34
appCompatVersion = "1.7.0"
}
I am using Flutter 3.24.0 • channel stable , while building resale apk i am getting ... .gradle\caches\transforms-3\f58020c91a078450a7656e43f041db18\transformed\core-1.13.1\res\values\values.xml:113:5-122:25: AAPT: error: resource android:attr/lStar not found. Can anyone help me in this
I am using Flutter 3.24.0 • channel stable , while building resale apk i am getting ... .gradle\caches\transforms-3\f58020c91a078450a7656e43f041db18\transformed\core-1.13.1\res\values\values.xml:113:5-122:25: AAPT: error: resource android:attr/lStar not found. Can anyone help me in this
Try to add below ext
code in android/build.gradle
under allprojects{}
, and use them in android/app/build.gradle
as the presentation of the help doc Android Setup
allprojects {
...
}
ext {
compileSdkVersion = 34
targetSdkVersion = 34
appCompatVersion = "1.7.0"
}
I have tried this but the problem is same, can not build the release apk. I guess it is some issue with the new release and dependencies.
I have tried this but the problem is same, can not build the release apk. I guess it is some issue with the new release and dependencies.
I'm also using Flutter 3.24.0, but I can build the release APK.
You can try to do the below code in the android/app/build.gradle
:
android {
def buildConfig = rootProject.extensions.getByName("ext")
compileSdk buildConfig.compileSdkVersion
defaultConfig {
...
targetSdkVersion buildConfig.targetSdkVersion
...
}
...
}
If the problem is still there, you need to post your android/build.gradle
and android/app/build.gradle
to help you analyse the reason.
This problem is related to the compileSdkVersion and targetSdkVersion of the plugins. This problem occurs because the compileSdkVersion and targetSdkVersion of some plugins are outdated. Either go to the source files of the plugin in your project and make the compileSdkVersion and targetSdkVersion versions the same as your project (version 34 compatible), or add the code block below to the build.gradle file in your project directory.
subprojects { afterEvaluate { android { compileSdkVersion 34 } } }
This code is a Gradle configuration script used in Android projects. The subprojects block allows you to configure certain settings for all subprojects (modules) in the project. The android block inside defines Android-related configuration settings, and the compileSdkVersion 34 line allows projects to be compiled with Android API 34.
Post both your .gradle files.
`allprojects { repositories { google() mavenCentral() } }
rootProject.buildDir = "../build"
subprojects { afterEvaluate { android { compileSdkVersion 34 } } }
subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") }
tasks.register("clean", Delete) { delete rootProject.buildDir } `
Post the entire contents of both your gradle files:
app/build.gradle
`allprojects { repositories { google() mavenCentral() } }
rootProject.buildDir = "../build"
subprojects { afterEvaluate { android { compileSdkVersion 34 } } }
subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") }
tasks.register("clean", Delete) { delete rootProject.buildDir } `
You have not added maven { url "${project(':background_fetch').projectDir}/libs" }
in allprojects
, follow this doc: Android Setup
allprojects {
repositories {
google()
mavenCentral()
// [required] background_fetch
maven { url "${project(':background_fetch').projectDir}/libs" }
}
}
@Aziz-T i suggest you consult with the required Android Setup Instructions, linked in the readme and carefully follow ALL the instructions.
I upgraded cupertino_icons to the latest version and it works now hope this helps someone.
If you are like me and have updated to the new Flutter version, You can consider this temporary solution https://github.com/livekit/client-sdk-flutter/issues/569#issuecomment-2275686786
My plug-ins never hard-code sdk versions, they read them from ext
vars in your build.gradle
. All plugin authors should do this but most don’t.
we learned to do this years ago in the React Native world.
nsformed\core-1.13.1\res\values\values.xml:113:5-122:25: AAPT: error: resource android:attr/lStar not found. Can anyone help me in this
bhai tera huaa kya, m b pareshaan hu
I am using Flutter 3.24.0 • channel stable , while building resale apk i am getting ... .gradle\caches\transforms-3\f58020c91a078450a7656e43f041db18\transformed\core-1.13.1\res\values\values.xml:113:5-122:25: AAPT: error: resource android:attr/lStar not found. Can anyone help me in this
rootProject.buildDir = "../build" **** ADD GIVEN LINE AND TRY BABY**** subprojects { afterEvaluate { project -> if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) { project.android { compileSdkVersion 34 buildToolsVersion "34.0.0" } } } } **** BUS YHI TAK PASTE KRNA BETAA***** subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") }
tasks.register("clean", Delete) { delete rootProject.buildDir }
This problem is related to the compileSdkVersion and targetSdkVersion of the plugins. This problem occurs because the compileSdkVersion and targetSdkVersion of some plugins are outdated. Either go to the source files of the plugin in your project and make the compileSdkVersion and targetSdkVersion versions the same as your project (version 34 compatible), or add the code block below to the build.gradle file in your project directory.
subprojects { afterEvaluate { android { compileSdkVersion 34 } } }
This code is a Gradle configuration script used in Android projects. The subprojects block allows you to configure certain settings for all subprojects (modules) in the project. The android block inside defines Android-related configuration settings, and the compileSdkVersion 34 line allows projects to be compiled with Android API 34.
ext { compileSdkVersion = 34 targetSdkVersion = 34 appCompatVersion = "1.7.0" }
subprojects { afterEvaluate { android { compileSdkVersion 34 } } }
it working for me for release build in latest flutter 3.24 version.
I am facing the same problem, below is m app level build.gradle; I am using flutter 3.24.1 stable channel plugins { id "com.android.application" id "kotlin-android" 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.panda.panda_rider" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.panda.panda_rider"
// 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.
minSdkVersion 34
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 '../..' }
dependencies {}
Same issues +++++++++++++++++++++++++++ % flutter --version Flutter 3.24.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 5874a72aa4 (10 天前) • 2024-08-20 16:46:00 -0500 Engine • revision c9b9d5780d Tools • Dart 3.5.1 • DevTools 2.37.2
+++++++++++++++++++++++++++ FAILURE: Build completed with 2 failures.
What went wrong: Execution failed for task ':flutter_wallpaper_manager:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/zhouruibin/Documents/renew_spirit/apps/renew/build/flutter_wallpaper_manager/intermediates/merged_res/release/values/values.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.
What went wrong: Execution failed for task ':image_gallery_saver:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/zhouruibin/Documents/renew_spirit/apps/renew/build/image_gallery_saver/intermediates/merged_res/release/values/values.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.
Get more help at https://help.gradle.org ++++++++++++++++++++++++++++++++
Search "AAPT: error: resource android:attr/lStar not found.":
https://stackoverflow.com/questions/69033022/message-error-resource-androidattr-lstar-not-found
background_fetch
100% working solution:
the problem is with background_fetch package that you used in pubspec.yaml. comment or remove this package then make the build. it will must work.
note: the to find the problem: when you get the error check the direction first.ERROR:/home/sonu/projects/flutter/H-ATTENDANCE/build/background_fetch/intermediates/merged_res/release/values/values.xml:2520: AAPT: error
so here: search immediate folder after build folder. here immediate folder is 'background_fetch'. so, the problem is in backgroudn fetch package. there may have file missing when the package is downloaded. this is why the error(resource android:attr/lStar not found) came.
@RahajulAminRaju
100% working solution:
No!. This error is typically associated with the Android dependency androidx.appcompat.appcompat
check your appCompatVersion
.
people having problems with this likely have multiple plugins importing different versions of this dependency.
Consult https://maven.google.com appcompat
.
to see a dependency tree of your app, execute:
$ ./gradlew app:dependencies
This plug-in is happy to import any version of appcompat
that you wish. As the Setup Instructions remark “or higher / as desired”
{
appCompatVersion = "1.4.2" // or higher / as desired
}
I was facing this issue, and finded a fix to my case. Sharing just in case help someone.
In my case, the issue was the PDF package and PRINTING package.
Upgraded to this versions and fixed the issue: pdf: ^3.11.1 printing: ^5.13.2
If you use firebase too, consider reading this PR: https://github.com/firebase/flutterfire/pull/13200
Would really help me if someone can check my code or give any advise. In advance thank you !
My current versions are:
Flutter 3.24.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5874a72aa4 (2 weeks ago) • 2024-08-20 16:46:00 -0500
Engine • revision c9b9d5780d
Tools • Dart 3.5.1 • DevTools 2.37.2
Channel -> Stable
The problem only occurs in release mode, not debug.
I've tried updating the app/build.gradle & android/build.gradle, but the error persists.
Execution failed for task :gdpr_dialog:verifyReleaseResources
.
A failure occurred while executing
com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed:
ERROR:
C:\Users\nameuser\Desktop\appname\newflutter\build\gdpr_dialog\intermediates\merged_res\release\values\values.xml:196: AAPT: error: resource android:attr/lStar not found.
I upgraded my dependencies in pubspec.yaml
using:
flutter pub outdated
flutter pub upgrade --major-versions
Tried resources:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
android {
// Added by the comments
def buildConfig = rootProject.extensions.getByName("ext")
compileSdkVersion rootProject.ext.compileSdkVersion // Added checking the INSTALL-ANDROID.md
namespace = "com.example.newflutter"
compileSdk = 34
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId = "com.example.newflutter"
minSdk = 21
targetSdk = 34
versionCode = flutter.versionCode
versionName = flutter.versionName
// Added checking the INSTALL-ANDROID.md
targetSdkVersion rootProject.ext.targetSdkVersion
}
buildTypes {
release {
signingConfig = signingConfigs.debug
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.work:work-runtime:2.7.0'
implementation project(path: ':gdpr_dialog')
}
flutter {
source = "../.."
}
buildscript {
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2' // or 8.0.2 for Java 11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "${project(':background_fetch').projectDir}/libs" }
}
configurations.all {
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
}
ext {
compileSdkVersion = 34
targetSdkVersion = 34
// Had an error with the compiler changed from 1.7 to 1.6.1 works now
appCompatVersion = "1.6.1"
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Show me the result of the following command (it’s a lot of output)
$ cd android
$ ./gradlew app:dependencies
Try version 1.3.6
(just released). I've removed the android dependency androidx.appcompat:appcompat
from the plugin's build.gradle
(it turns out it's not required).
Add this to android/build.gradle
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android { compileSdkVersion 34 }
}
}
}
In version 1.3.7
, I have removed the appcompat
dependency.
Add this to android/build.gradle
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android { compileSdkVersion 34 }
}
}
}
This plugin does not require this if you provide the required ext
vars (including ext.compileSdkVersion
) in your root build.gradle
, as documented in the Android Setup Instructions
Of course, other plugins may have hard-coded compileSdkVersion
, requiring that override, but this plugin does not.