Skip to content

[flutter_plugin_android_lifecycle] Fails to compile on versions of flutter prior to 3.27.  #164362

Closed

Description

@sabarinath-kv

Steps to reproduce

Take android build (flutter version 3.24.1)

Expected results

Android build should succeed

Actual results

android build is failing

Code sample

Code sample
1.  What went wrong:
A problem occurred evaluating project ':flutter_plugin_android_lifecycle'.
> Could not get unknown property 'flutter' for extension 'android' of type com.android.build.gradle.LibraryExtension.

2. What went wrong:
A problem occurred configuring project ':flutter_plugin_android_lifecycle'.
Failed to notify project evaluation listener.
 Cannot invoke method substring() on null object
 compileSdkVersion is not specified. Please add it to build.gradle

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Activity

  1. Cedar-byte commented on Feb 28, 2025

    @Cedar-byte
  2. phuc-tranh-otsv commented on Feb 28, 2025

    @phuc-tranh-otsv

    Same error in version flutter_plugin_android_lifecycle 2.0.25.
    I add flutter_plugin_android_lifecycle 2.0.24 to dependency_overrides before any update to fix error when run flutter "build" "appbundle"

  3. phuc-tranh-otsv commented on Feb 28, 2025

    @phuc-tranh-otsv

    After investigate, I can see the root cause of your error.
    The public final int compileSdkVersion = 35 in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy#L52C22-L52C39
    released for flutter from version 3.27.0.
    If you use flutter_plugin_android_lifecycle 2.0.25 with flutter version < 3.27.0. You will get the error.
    You can

    • Solution 1: upgrade flutter version for your project
    • Solution 2: use dependency_overrides to fix it before plan to upgrade flutter version for your project.
  4. abdul61093312 commented on Feb 28, 2025

    @abdul61093312

    @phuc-tranh-otsv is there anything else need to be changed apart from dependency overrides? looks like it is not working while build the android build on App centre

  5. Cedar-byte commented on Feb 28, 2025

    @Cedar-byte

    dependency_overrides had this error after setting and I finally fixed this error by upgrading the flutter version number to 3.27.0, I had to get used to the new version, headache

  6. darshankawar commented on Feb 28, 2025

    @darshankawar
    Member

    @sabarinath-kv
    Please upgrade to latest stable and re-run your scenario to check if this is fixed or not.

  7. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 28, 2025
  8. abdul61093312 commented on Feb 28, 2025

    @abdul61093312

    @sabarinath-kv Please upgrade to latest stable and re-run your scenario to check if this is fixed or not.

    Building with 3.27.1 is working for me

  9. reidbaker commented on Feb 28, 2025

    @reidbaker
    Contributor

    I did realize that the ability to reference flutter.compileSdkVersion was a 3.27 and higher feature. What I failed to realize was that the minimum flutter version was not already 3.27.

    I will patch forward change that sets the compile sdk version to 35 then bump the min flutter version then reland the change to use flutter.compileSdkVersion.

    Sorry for the trouble.

  10. self-assigned this
    on Feb 28, 2025
  11. changed the title [-]Not able to take android build[/-] [+][flutter_plugin_android_lifecycle] Fails to compile on versions of flutter prior to 3.27. [/+] on Feb 28, 2025
  12. added
    c: regressionIt was better in the past than it is now
    P0Critical issues such as a build break or regression
    on Feb 28, 2025
  13. normidar commented on Feb 28, 2025

    @normidar

    My error message:

    * What went wrong:
    Failed to query the value of property 'buildFlowServiceProperty'.
    > Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@71de0fd9 of type BuildFlowService.Parameters
       > A problem occurred configuring project ':flutter_plugin_android_lifecycle'.
          > Failed to notify project evaluation listener.
             > Cannot invoke method substring() on null object
             > com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
    
    * 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.
    ==============================================================================
    
    BUILD FAILED in 10s
    Error: Gradle task assembleDebug failed with exit code 1
    
    

    env:

    Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision dec2ee5c1f (4 months ago) • 2024-11-13 11:13:06 -0800
    Engine • revision a18df97ca5
    Tools • Dart 3.5.4 • DevTools 2.37.3
    
  14. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on Mar 3, 2025
  15. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 7, 2025
  16. github-actions commented on Mar 21, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressionc: regressionIt was better in the past than it is nowp: flutter_plugin_android_lifecycleThe flutter_plugin_android_lifecycle pluginplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions