AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
379 stars 453 forks source link

error: resource android:attr/lStar not found #356

Open kururu-abdo opened 3 weeks ago

kururu-abdo commented 3 weeks ago

anyone experience this error on Flutter 3.19?

Murkrow02 commented 3 weeks ago

I'm having this issue too when building an android APK

stan-at-work commented 3 weeks ago

Me to:

image image

usmanmsd007 commented 3 weeks ago

I was trying flutter build apk and was facing the same issue. Than I tried to update the kotin version insdie settings.gradle to 2.0.20. After that I made the following changes to: ~/.pub-cache/hosted/pub.dev/flutter_barcode_scanner-2.0.0/android/build.gradle


android {
    compileSdkVersion 34

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 34
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

the compilesdk and tragetsdk versions should follow the project versions. Than flutter clean; flutter pub get; flutter build apk and it worked.

i5hi commented 2 weeks ago

Facing the same issue

i5hi commented 2 weeks ago

This helped me temporarily fix the issue (seems to be related to Flutter 3.24):

in android/build.gradle

subprojects {
    afterEvaluate { project ->
        if (project.plugins.hasPlugin("com.android.application") ||
                project.plugins.hasPlugin("com.android.library")) {
            project.android {
                compileSdkVersion 34
                buildToolsVersion "34.0.0"
            }
        }
    }
}

https://github.com/livekit/client-sdk-flutter/issues/569#issuecomment-2275686786

rohintonc commented 2 weeks ago

I found the same solution as others. changing the compileSdkVersion and targetSdkVersion from 30 to 31 in the package's build.gradle file fixed the issue:

android {
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 31
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

Error when building for release (debug didn't show the error for some reason):

Execution failed for task ':flutter_barcode_scanner:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/-/IDZ/flutter-app/zcloud/build/flutter_barcode_scanner/intermediates/merged_res/release/values/values.xml:6135: AAPT: error: resource android:attr/lStar not found.

This PR should fix this issue as it updates the compileSdkVersion and targetSdkVersion to 34: https://github.com/AmolGangadhare/flutter_barcode_scanner/pull/348

wrteam-anish commented 2 weeks ago

To temporary solve the issue you can use this following code:

Replace it in pubspec.yaml file

 flutter_barcode_scanner:
     git:
       url: https://github.com/wrteam-anish/flutter_barcode_scanner.git
       ref: master

Thank you!

Ferrb9579 commented 1 week ago

+1

bldr1862 commented 1 week ago

I'll give it a try, thanks!

KlausJuhantalo commented 1 week ago

simple_barcode_scanner 0.1.1 depends on flutter_barcode_scanner ^2.0.0 and no versions of simple_barcode_scanner match >0.1.1 <0.2.0, simple_barcode_scanner ^0.1.1 requires flutter_barcode_scanner from hosted. So, because app depends on both flutter_barcode_scanner from git and simple_barcode_scanner ^0.1.1, version solving failed.

iamansuman commented 1 week ago

I tried building with compileSdk = 34 minSdk = 33 targetSdk = 34

Flutter version: 3.24.2-stable Kotlin version: 1.7 Gradle version: 7.6 JDK: 19.0.2

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_barcode_scanner:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:<path to project DIR>\build\flutter_barcode_scanner\intermediates\merged_res\release\values\values.xml:6135: AAPT: error: resource android:attr/lStar not found.
wrteam-anish commented 1 week ago

I tried building with compileSdk = 34 minSdk = 33 targetSdk = 34

Flutter version: 3.24.2-stable Kotlin version: 1.7 Gradle version: 7.6 JDK: 19.0.2

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_barcode_scanner:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:<path to project DIR>\build\flutter_barcode_scanner\intermediates\merged_res\release\values\values.xml:6135: AAPT: error: resource android:attr/lStar not found.

set minSdk = 21 and try also delete .gradle folder and delete pubspec.lock

BFSistemi commented 4 days ago

This helped me temporarily fix the issue (seems to be related to Flutter 3.24):

in android/build.gradle

subprojects {
    afterEvaluate { project ->
        if (project.plugins.hasPlugin("com.android.application") ||
                project.plugins.hasPlugin("com.android.library")) {
            project.android {
                compileSdkVersion 34
                buildToolsVersion "34.0.0"
            }
        }
    }
}

livekit/client-sdk-flutter#569 (comment)

This solution worked for me