The generated aar for native plugin in build/host/outputs/repo should have a correct version number.
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. create a flutter project
2. add a plugin with native code, such as image_picker(It depens on image_picker_android)
3. build AAR for android with `flutter build aar --build-number 2.0`
4. check the output assets located in `"${projectRoot}/build/host/outputs/repo/io/flutter/plugins/imagepicker/image_picker_android_release/"`. The generated version of aar will be "2.0"(same as `--build-number` specified).
5. check the version number of `image_picker_android` in `${projectRoot}/pubspec.lock`, It might be "0.8.12+1".
6. clean the workspace with `flutter clean`(this will not remove `pubspec.lock`)
7. re-build AAR for android with `flutter build aar --build-number 3.0`
8. check the output assets again. The generated version of aar will be "3.0" this time.
9. check the version number of `image_picker_android` in `${projectRoot}/pubspec.lock`, It should still be "0.8.12+1".
### Expected results
The generated aar for image_picker_android in `"${projectRoot}/build/host/outputs/repo/io/flutter/plugins/imagepicker/image_picker_android_release/"` should retain it's version number when I rebuild aar without changeing it's version.
### Actual results
It always has the same version of `--build-number`, even though I didn't change the version number of image_picker in pubspec.yaml.
### Code sample
Code sample for pubspec.yaml
```yaml
version: 1.0.0+1
environment:
sdk: ^3.6.0-91.0.dev
dependencies:
flutter:
sdk: flutter
image_picker: 1.0.0
dev_dependencies:
flutter_lints: ^4.0.0
flutter:
module:
androidX: true
androidPackage: com.example.flutter_project
iosBundleIdentifier: com.example.flutterProject
```
### Screenshots or Video
_No response_
### Logs
_No response_
### Flutter Doctor output
Doctor output
```console
[✓] Flutter (Channel master, 3.24.0-1.0.pre.349, on macOS 14.5 23F79 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 15.4)
✗ Unable to get list of installed Simulator runtimes.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (3 available)
[✓] Network resources
```
Contributor guide
Assessment
This issue has not been assessed yet.