New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter tries to install old android build tools/platforms to build APK #63533
Comments
Reproducible on the latest master flutter doctor -v
As the author said flutter will use any installed version of build tools and Android SDK when changing the Tested with fresh After adding Could be that this behavior is intended but I can't find documentation for it anywhere. @warcayac Please refrain from including images if at all possible. The logs and build.gradle changes can't be copied without manually transcribing them. |
cc @GaryQian |
It seems very similar to #41462 |
@jonahwilliams any updates on this? Some users of Flutter's Docker image are reporting this issue and I'm not sure if it makes sense to include the old SDKs since it grows the images size from 1Gb to 3Gb. See cirruslabs/docker-images-flutter#115 |
its because of your package.. if creater use sdk 30.. then you need to use sdk 30 .. same. |
Is there an easy way to figure out which packages brings the old sdk version? |
Is that the reason why Flutter is trying to use SDK Built Tools revision 2.8.0.3 instead of 30 in 1.25.5? Any workaround available? There is some kind of little problem with API levels below 30. So if something isn't done now, practically Flutter will be a toy soon. |
So basically, all the different SDK that were used to build all the libraries used in a project have to be present, am I right? |
Anyone was able to solve this? |
This issue need more attention. |
This comment was marked as abuse.
This comment was marked as abuse.
I was recently annoyed again by this issue and decided to investigate a bit. Unfortunately it looks like no simple solution is available - you just have to not depend on plugins that want to be compiled against older Android SDK versions. In other words, if at least 1 Android plugin your Flutter app depends on has The only thing we can do is to politely ask authors of all plugins we use to target the latest stable Android SDK version (as of today (30/03/2024) this is 34). The process of manually checking each plugin's pubspec.yamlname: discover_rudy
description: Cross-platform app for tourists.
version: 1.0.0+1 # versionName and versionCode are set automatically by CI
publish_to: none
environment:
sdk: ">=3.3.0 <4.0.0"
flutter: 3.19.0
dependencies:
animated_text_kit: ^4.2.2
animations: ^2.0.11
archive: ^3.4.10
async: ^2.11.0
bloc: ^8.1.4
bloc_presentation: ^1.0.0
cached_network_image: ^3.3.1
cloud_firestore: ^4.15.9
collection: ^1.18.0
connectivity_plus: ^6.0.1
crypto: ^3.0.3
cupertino_icons: ^1.0.6
equatable: ^2.0.5
firebase_auth: ^4.17.9
firebase_core: 2.27.1 # because of precompiled version in ios/Podfile
firebase_crashlytics: ^3.4.19
firebase_storage: ^11.6.10
flutter:
sdk: flutter
flutter_bloc: ^8.1.5
flutter_blurhash: ^0.8.2
flutter_downloader: ^1.11.6
flutter_hooks: ^0.20.5
flutter_localizations:
sdk: flutter
flutter_markdown: ^0.6.22
flutter_plugin_android_lifecycle: ^2.0.17
flutter_svg: ^2.0.10+1
freezed_annotation: ^2.4.1
geolocator: ^11.0.0
go_router: ^13.2.1
google_maps_flutter: ^2.6.0
google_nav_bar: ^5.0.6
google_sign_in: ^6.2.1
hexcolor: ^3.0.1
http: ^1.2.1
hydrated_bloc: ^9.1.5
image_picker: ^1.0.7
intl: ^0.18.1
intro_slider: ^4.2.1
json_annotation: ^4.8.1
location: ^5.0.3
logging: ^1.2.0
package_info_plus: ^6.0.0
path: ^1.9.0
path_provider: ^2.1.2
percent_indicator: ^4.2.3
photo_view: ^0.14.0
provider: ^6.1.2
rxdart: ^0.27.7
share_plus: ^8.0.2
sign_in_with_apple: ^5.0.0
url_launcher: ^6.2.5
wave: ^0.2.2
dev_dependencies:
bloc_test: ^9.1.7
build_runner: ^2.4.8
custom_lint: ^0.6.4
flutter_gen_runner: ^5.4.0
flutter_launcher_icons: ^0.13.1
flutter_test:
sdk: flutter
freezed: ^2.4.7
go_router_builder: ^2.4.1
json_serializable: ^6.7.1
leancode_lint: ^11.0.0
mocktail: ^1.0.3
flutter_icons:
android: false
ios: true
image_path: art/appicon.png
flutter:
uses-material-design: true
assets:
- assets/
- assets/images/
- assets/map_styles/
flutter_native_splash:
color: "#669900"
image: art/appicon_transparent.png
flutter_gen:
output: lib/resources
it prints:
Here is the script's source code. If you're on macOS, just I hope this is useful ✌🏻 cheers Footnotes
|
There's an interesting question here of what, if anything, we should do in the tool here. We could certainly raise awareness of this by warning when packages are using older versions of the compile SDK than the app is (as we currently do if they use a newer version), but that would be a very noisy warning for something that isn't directly actionable by the app developer, and is mostly harmless. Maybe we could put something in the just the plugin's example app template that would warn if the compile SDK for the plugin is less than the current Flutter-tool-recommended SDK. It wouldn't hurt, but I'm skeptical it would be seen much by plugin devs. |
I have something like this in my subprojects {
afterEvaluate {
if (it.hasProperty('android')) {
android {
compileSdkVersion android_version
}
}
}
} |
@kuhnroyal This is great! I think this may hide possible problems with a plugin that needs to be updated to work well with higher |
Could probably compare it before setting it and emit a warning. |
Reproducible on the latest versions on flutter. Steps to reproduce
Additional/optional steps
logs
flutter doctor -v
|
FYI @kuhnroyal, for me this fails with Logs
I'm using AGP 8.2.0, Gradle 8.7, and Flutter 3.19.0. EDITFixed by doing this in rootProject.buildDir = "../build"
subprojects {
afterEvaluate {
android {
compileSdkVersion 34
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
} |
@bartekpacia I might have removed too much before posting :) I have similar handling there for missing namespaces etc. as well. |
Steps to Reproduce
flutter create xelophone_flutter
:Properties: CompileSdkVersion and buildToolsVersion
Properties: DistributionUrl
flutter pub get
), then when trying to run app, it tries to install packages API 28 to build APKExpected results:
Actual results:
Logs
1. Running... *OK*Flutter Doctor
SDK Manager
Gradle
System
The text was updated successfully, but these errors were encountered: