OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
615 stars 213 forks source link

[Bug]: lStar not found issue when using onesignal_flutter: ^5.2.2 with Flutter SDK 3.24.0 due to compileSdkVersion 28 #930

Closed sohyuyuan closed 1 week ago

sohyuyuan commented 1 month ago

What happened?

I am encountering a lStar not found issue when attempting to build my Flutter application in release mode using the onesignal_flutter: ^5.2.2 package. This issue occurs after upgrading to Flutter SDK 3.24.0.

Steps to reproduce?

1. Upgrade Flutter SDK to 3.24.0.
2. Create a Flutter project.
2. Add the onesignal_flutter: ^5.2.2 package to the pubspec.yaml file.
3. Attempt to build the APK in release mode using flutter build apk --release

What did you expect to happen?

The application should build successfully without any issues.

Proposed Solution: To resolve this issue, the onesignal_flutter should update its Android build.gradle to utilise compileSdk 31 or higher.

OneSignal Flutter SDK version

Release 5.2.2

Which platform(s) are affected?

Relevant log output

flutter build apk --release

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':onesignal_flutter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/sohyuyuan/Documents/TestProject/test_firebase_auth/build/onesignal_flutter/intermediates/merged_res/release/values/values.xml:2657: AAPT: error: resource android:attr/lStar not found.

flutter doctor -v

[✓] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale en-MY)
    • Flutter version 3.24.0 on channel stable at /Users/sohyuyuan/fvm/versions/3.24.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (9 days ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/sohyuyuan/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C65
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.92.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.94.0

[✓] Connected device (3 available)            
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 127.0.6533.100

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

• No issues found!

Code of Conduct

AnkitFlutterDev commented 1 month ago

i am also facing this same issue in flutter latest version 3.24.0 i am upgrading my project which is i created around 18 month ago and change onesignal_flutter version 3.5.0 to 5.2.2,and also made some changes like / OneSignal.shared.setAppId(oneSignalAppId); OneSignal.shared .promptUserForPushNotificationPermission() .then((accepted) {}); / OneSignal.Debug.setLogLevel(OSLogLevel.verbose); OneSignal.initialize(oneSignalAppId); OneSignal.Notifications.requestPermission(true).then((accepted) { debugPrint(" #####OneSignal Permission Accepted:$accepted #####"); });

android and ios both working fine in emulator/simulator and notification also working fine 
but whenever i tried to generate debug/release apk i got error same as like

* What went wrong:

Execution failed for task ':onesignal_flutter:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/ankitthummar/Desktop/fl_rc_supreme_web/build/onesignal_flutter/intermediates/merged_res/release/values/values.xml:2657: AAPT: error: resource android:attr/lStar not found.

anmolstuteja commented 1 month ago

I'm facing the same issue.

anmolstuteja commented 1 month ago

There seems to be a issue with the latest flutter version 3.24.0 after downgrading to 3.22.3 it's working.

EDnny12 commented 1 month ago

Same

this-sunil commented 1 month ago

Some developer update latest version update this dependecies

sunilshedge commented 1 month ago
sunilshedge commented 1 month ago

update compile sdk version compileSdkVersion 34

sunilshedge commented 1 month ago

main android folder group 'com.onesignal.flutter' version '5.2.2'

buildscript { repositories { google() mavenCentral() }

dependencies {
    classpath 'com.android.tools.build:gradle:7.0.0'
}

}

rootProject.allprojects { repositories { google() mavenCentral() } }

apply plugin: 'com.android.library'

android { compileSdkVersion 34 // Condition for namespace compatibility in AGP <4.2 if (project.android.hasProperty("namespace")) { namespace 'com.onesignal.flutter' }

defaultConfig {
    minSdkVersion 16
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
    disable 'InvalidPackage'
}

}

dependencies { implementation 'com.onesignal:OneSignal:5.1.17' }

affan3699 commented 1 month ago

Facing Same Issue

najiezzeldien commented 1 month ago

Same Issue

haven-git commented 1 month ago

Same Issue

vagrantrobbie commented 1 month ago

Same issue

fadlialakbar commented 1 month ago

Same issue here

dllzar commented 1 month ago

Same issue

newselfDevops commented 1 month ago

same issue

ilyasarafathemvigo commented 1 month ago

Same issue

SergioQuinonez commented 4 weeks ago

Same issue 😞

sunilshedge commented 4 weeks ago

please update this plugin onesignal i will changes in file then run my project

GeceGibi commented 4 weeks ago

Any changes ?!?!?*1!?

sohyuyuan commented 4 weeks ago

Add the code block below to the android/build.gradle file in your project directory.

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    // Add this
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
    // End
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

The 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 afterEvaluate block contains code that will run after the initial configuration is completed, ensuring that all settings are fully read and evaluated before making any changes.

The android block defines Android-related configuration settings, and the compileSdkVersion 34 line ensures that projects are compiled with Android API 34. This is important for leveraging the latest API features on Android, as newer APIs generally offer better performance, security, and new features.

After implementing these changes, you should perform comprehensive testing throughout the entire project to ensure that everything functions as expected. Additionally, be mindful of potential side effects that might affect other dependencies in your project.

sohyuyuan commented 4 weeks ago

This is a temporary solution. I still recommend that the OneSignal team upgrade the compile SDK version and perform a comprehensive evaluation of their package.

Add the code block below to the android/build.gradle file in your project directory.

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    // Add this
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
    // End
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

The 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 afterEvaluate block contains code that will run after the initial configuration is completed, ensuring that all settings are fully read and evaluated before making any changes.

The android block defines Android-related configuration settings, and the compileSdkVersion 34 line ensures that projects are compiled with Android API 34. This is important for leveraging the latest API features on Android, as newer APIs generally offer better performance, security, and new features.

After implementing these changes, you should perform comprehensive testing throughout the entire project to ensure that everything functions as expected. Additionally, be mindful of potential side effects that might affect other dependencies in your project.

najiezzeldien commented 3 weeks ago

@sohyuyuan It work for me Thank you

AnkitFlutterDev commented 3 weeks ago

onesignal_flutter: ^5.2.3 released any one tried this one? and stil facing same issue?

vagrantrobbie commented 3 weeks ago

onesignal_flutter: ^5.2.3 released any one tried this one? and facing same issue?

Yep, I still receive the same error. I just tried to compile using onesignal_flutter: ^5.2.3 on Android but no fix.

@sohyuyuan has a solution so you can continue to build and release on Android but it would be great if the OneSignal team were able to fix properly

rahulmukh1ya commented 3 weeks ago

I am facing the same issue. It started to occur after I upgraded the flutter version to 3.24.0. Also, I am currently using one signal version 5.2.3 (which happens to be the latest version as of writing this comment). The only solution I found is downgrading the flutter version.

kleyber-ribeiro commented 2 weeks ago

Same issue here and I'm using the version 5.2.3 of OneSignal and the (temporary) solution was from @sohyuyuan. In my case, I don't want to downgrade the Flutter version.

this-sunil commented 2 weeks ago

Why updating your package if you doesn't getting permanent solution please update compilesdk version and targetsdk version 34 in your latest updates targetsdk 33 and compile sdk 34 this is reason your updating package doesn't work.please before testing then update your package so many developer use your plugin and updating flutter package

Namr547 commented 2 weeks ago

@sohyuyuan Thanks alot brother. yesterday i spent 15 hours in office but didn't solve the issue now I just found you solution and it worked

nextvisionmx commented 2 weeks ago

Thanks @sohyuyuan !!

jennantilla commented 1 week ago

Hello everyone! Thanks for your patience. This should be fixed in 5.2.4. Please let us know if there are any additional questions or concerns.

this-sunil commented 1 week ago

Update gradle 7.0.0 in build.gradle could not parse pom com.android.tools:common:30.0.0 content not allowed in prolog . change below line classpath 'com.android.tools.build:gradle:8.1.0'

sohyuyuan commented 1 week ago

Closing the issue as version5.2.4 is no longer blocking me from building the Android APK.

Hello everyone! Thanks for your patience. This should be fixed in 5.2.4. Please let us know if there are any additional questions or concerns.

this-sunil commented 1 week ago

Update gradle 7.0.0 to 8.1.0

On Mon, 2 Sept 2024, 8:48 am sohyuyuan, @.***> wrote:

Closing the issue as version5.2.4 https://github.com/OneSignal/OneSignal-Flutter-SDK/releases/tag/5.2.4 is no longer blocking me from building the Android APK.

Hello everyone! Thanks for your patience. This should be fixed in 5.2.4 https://github.com/OneSignal/OneSignal-Flutter-SDK/releases/tag/5.2.4. Please let us know if there are any additional questions or concerns.

— Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/930#issuecomment-2323734099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMIGS2YA3B2ZN6WNSKFP2QLZUPKJLAVCNFSM6AAAAABMHUSEKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTG4ZTIMBZHE . You are receiving this because you commented.Message ID: @.***>