Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug]: Profile Android build failing after geolocator_android 4.6.2 with Flutter 3.24.x #1666

Open
3 of 8 tasks
smallTrogdor opened this issue Mar 21, 2025 · 21 comments
Open
3 of 8 tasks

Comments

@smallTrogdor
Copy link

smallTrogdor commented Mar 21, 2025

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

Steps to reproduce

  1. fvm use 3.24.5
  2. fvm flutter create . --platforms=android
  3. fvm flutter pub add geolocator
  4. fvm flutter pub get (geolocator_android 4.6.2. is pulled)
  5. fvm flutter build appbundle --profile --no-pub

Expected results

Build runs without exceptions and outputs the .aab file for all supported Flutter SDK versions.

Actual results

➜  demo ✗ fvm flutter build appbundle --profile --no-pub


FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/smallTrogdor/.pub-cache/hosted/pub.dev/geolocator_android-4.6.2/android/build.gradle' line: 29

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

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':geolocator_android'.
> Failed to notify project evaluation listener.
   > Cannot invoke method substring() on null object
   > 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 1m 10s
Running Gradle task 'bundleProfile'...                             71.7s
Gradle task bundleProfile failed with exit code 1

Code sample

The minimum Flutter example created with flutter create will do.

Version

13.0.3

Flutter Doctor output

Doctor Summary
[✓] Flutter (Channel stable, 3.24.5, on macOS 14.6.1 23G93 darwin-arm64, locale en-CH)
    • Flutter version 3.24.5 on channel stable at /Users/smallTrogdor/fvm/versions/3.24.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (4 months ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/smallTrogdor/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /opt/homebrew/opt/sdkman-cli/libexec/candidates/java/current/bin/java
    • Java version OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2024.2)
    • 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 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

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

[✓] Connected device (3 available)
    • SM S911B (mobile)               • RFCWC1CLMKK           • android-arm64 • Android 14 (API 34)
    • macOS (desktop)                 • macos                 • darwin-arm64  • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin        • macOS 14.6.1 23G93 darwin-arm64

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

! Doctor found issues in 1 category.
@smallTrogdor smallTrogdor changed the title [Bug]: Profile Android build failing after 4.6.2 with Flutter 3.24.x [Bug]: Profile Android build failing after geolocator_android 4.6.2 with Flutter 3.24.x Mar 21, 2025
@horlas08
Copy link

same here

@Juanhu1
Copy link

Juanhu1 commented Mar 21, 2025

same problem for me

@Darwin99-debug
Copy link

Hi! I'm also facing the same problem. How can we handle it?

@chandMessi10
Copy link

upgrade flutter version from 3.24.5 to latest one 3.29.2 and it kind of fixed this error.

@horlas08
Copy link

upgrade flutter version from 3.24.5 to latest one 3.29.2 and it kind of fixed this error.

I upgrade my flutter yesterday to 3.29.2 because of the issue but still same thing
Here is what I did
fvm install 3.29.2
fvm global 3.29.2
Flutter --version
3.29.2
Flutter pub upgraded
Still the same issue

@horlas08
Copy link

I think the issue is related to geolocator_andriod which is upgraded 4days ago to 5.0.0 but geolocator is still using 4..

@chandMessi10
Copy link

I think the issue is related to geolocator_andriod which is upgraded 4days ago to 5.0.0 but geolocator is still using 4..

yes that is the main issue. the pubspec.lock file shows geolocator_android to 4.6.2.

I faced this issue yesterday and after not finding any solutions, tried with flutter version upgrade and it got fixed. can you also confirm the project is pointing to 3.29.2 @horlas08 .

@horlas08
Copy link

I think the issue is related to geolocator_andriod which is upgraded 4days ago to 5.0.0 but geolocator is still using 4..

yes that is the main issue. the pubspec.lock file shows geolocator_android to 4.6.2.

I faced this issue yesterday and after not finding any solutions, tried with flutter version upgrade and it got fixed. can you also confirm the project is pointing to 3.29.2 @horlas08 .

Yeah that's true I didn't point my project to 3.29.2 I will do that and revert back here thanks

@smallTrogdor
Copy link
Author

smallTrogdor commented Mar 22, 2025

upgrade flutter version from 3.24.5 to latest one 3.29.2 and it kind of fixed this error.

It is true that Flutter SDK >3.27.x does not face this issue. This is because from 3.27. onwards, the flutter Gradle plugin allowed using all properties that are absent before and result in the here described error. So people using Flutter SDK >3.27.x should not face this.

What I do not appreciate is upgrading the patch version of a plugin and not checking the compatibility towards older Flutter SDKs that are supported (in the pubspec.yaml file, currently 3.24.x is supported).

This leads to a situation where dependency resolving goes without problem to 4.6.2, but in the release / profile build (debugging does not fail) fails. Which is annoying.

There is no proper way for this package to work with Flutter SDK 3.24.x on Android anymore, even though it states so - which is sad.

@horlas08
Copy link

@chandMessi10 Thanks for your suggestion it works

@horlas08
Copy link

@chandMessi10 is not working this morning i think something is wrong same error i point my project to environment:
sdk: ">=3.7.2 <4.0.0" and i use fvm use 3.29.2 or is there any other way to point my project to 3.29.2 am using android studio

@horlas08
Copy link

@chandMessi10 what is ur dart sdk version

@chandMessi10
Copy link

@chandMessi10 what is ur dart sdk version

sdk: ^3.7.2

@chandMessi10
Copy link

@chandMessi10 is not working this morning i think something is wrong same error i point my project to environment: sdk: ">=3.7.2 <4.0.0" and i use fvm use 3.29.2 or is there any other way to point my project to 3.29.2 am using android studio

what is the flutter version you have selected in Settings -> Framework -> Flutter ?

@horlas08
Copy link

@chandMessi10 am using andriod studio > language and frameworks > flutter is 3.29.2 while dart is 3.7.2 and in my gradle-wrapper distribution Url is gradle-8.5-bin.zip

@chandMessi10
Copy link

@chandMessi10 am using andriod studio > language and frameworks > flutter is 3.29.2 while dart is 3.7.2 and in my gradle-wrapper distribution Url is gradle-8.5-bin.zip

make the gradle version 8.7 or 8.10. mine is 8.10

@horlas08
Copy link

@chandMessi10 ok let me try that now

@vasudev391
Copy link

for me temporary solution

update compileSdk flutter.compileSdkVersion to 35
minSdkVersion flutter.minSdkVersion to 21 or any set in your application

group 'com.baseflow.geolocator'
version '1.0'

buildscript {
    repositories {
        google()
        mavenCentral()
    }

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

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

apply plugin: 'com.android.library'

android {
    if (project.android.hasProperty("namespace")) {
        namespace("com.baseflow.geolocator")
    }

    compileSdk  35

    defaultConfig {
        minSdkVersion 21
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'com.google.android.gms:play-services-location:21.2.0'
    implementation 'androidx.core:core:1.13.0'

    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.mockito:mockito-core:5.1.1'
}

@hamhoney
Copy link

Check your dart sdk path and version.
File - Setting - Language & Frameworks - Dart - Dart SDK path

and check Version: 3.7.2

@horlas08
Copy link

@chandMessi10 am using andriod studio > language and frameworks > flutter is 3.29.2 while dart is 3.7.2 and in my gradle-wrapper distribution Url is gradle-8.5-bin.zip

make the gradle version 8.7 or 8.10. mine is 8.10

@chandMessi10 i got it working since then after using 8.10 sorry for the late update

@Kam5678
Copy link

Kam5678 commented Mar 25, 2025

I am still using Flutter 3.24.5.

With geolocator: ^12.0.0 due to some constraints.

I ran into this problem and solved by doing the following for now:

dependency_overrides:
  geolocator_android: 4.6.1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants