flutter/packages/flutter_tools/test/general.shard/android
Mikhail Novoseltsev ae6d79336e
[tool] fix android studio preview's version parsing (#156293)
This PR willing to fix issue when `flutter doctor` validator can't determine version of Android Studio EAP.

These are before/after outputs of `flutter doctor -v` showcasing change in behaviour of validator. Each output has 3 `Android Studio` sections, 1 for stable and 2 for different EAP versions. 

<details>
<summary>before, (stable, 3.24.3), 2 issues related to versions of Android Studio</summary>

```console
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-arm64, locale en-RU)
    • Flutter version 3.24.3 on channel stable at /Users/samer/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/samer/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode-16.0.app/Contents/Developer
    • Build 16A242d
    • 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 /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.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)

[!] Android Studio (version unknown)
    • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.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
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[!] Android Studio (version unknown)
    • Android Studio at /Users/samer/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
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47)
    • IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.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.94.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554             • android-arm64  • Android 15 (API 35) (emulator)
    • iPhone (Михаил) (mobile)        • 00008020-001254DA1E39002E • ios            • iOS 17.6.1 21G93
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.90
    ! Error: Browsing on the local area network for Михаил Новосельцев’s iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

! Doctor found issues in 2 categories.
```
</details>

<details>
<summary>after,  no issues regarding Android Studio</summary>

```console
[!] Flutter (Channel [user-branch], 3.26.0-1.0.pre.383, on macOS 14.7 23H124 darwin-arm64, locale en-RU)
    ! Flutter version 3.26.0-1.0.pre.383 on channel [user-branch] at /Users/samer/projects/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    • Upstream repository git@github.com:Sameri11/flutter.git
    • FLUTTER_GIT_URL = git@github.com:Sameri11/flutter.git
    • Framework revision 852508425d (20 minutes ago), 2024-10-07 21:22:45 +0500
    • Engine revision 683a14c1f1
    • Dart version 3.6.0 (build 3.6.0-326.0.dev)
    • DevTools version 2.40.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update
      checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/samer/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode-16.0.app/Contents/Developer
    • Build 16A242d
    • 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 /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.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)

[✓] Android Studio (version 2024.2.2)
    • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.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)

[✓] Android Studio (version 2024.2.1)
    • Android Studio at /Users/samer/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 EAP IU-243.12818.47)
    • IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.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.94.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554             • android-arm64  • Android 15 (API 35) (emulator)
    • iPhone (Михаил) (mobile)        • 00008020-001254DA1E39002E • ios            • iOS 17.6.1 21G93
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.90
    ! Error: Browsing on the local area network for Михаил Новосельцев’s iPad. Ensure the device is unlocked and attached with a cable or
      associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

! Doctor found issues in 1 category.
```
</details>

Logic behind these changes explained in https://github.com/flutter/flutter/issues/121925#issuecomment-2352826925 

fixes #121925

**Tests**: updated existing tests by adding version checking, but I don't mind writing new ones if necessary – please tell me if so.
2024-10-16 15:56:31 +00:00
..
migration Migrator for android 35/16kb page size cmake flags for plugin_ffi (#156221) 2024-10-08 08:41:09 +00:00
adb_log_reader_test.dart Remove outdated ignores from tool (#140467) 2023-12-20 22:14:32 +00:00
android_device_discovery_test.dart include exception details in tool exit displayed when adb call fails (#147498) 2024-04-30 17:38:21 +00:00
android_device_port_forwarder_test.dart add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
android_device_start_test.dart Add --trace-to-file option to flutter run (#135713) 2023-10-12 13:23:52 -04:00
android_device_test.dart Stop reading .packages from flutter_tools. (#154912) 2024-09-13 13:53:05 +02:00
android_emulator_test.dart add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
android_gradle_builder_test.dart [tool] Remove some usages of deprecated usage package (#151359) 2024-07-09 18:17:21 +00:00
android_install_test.dart [tool] Install the corresponding APK in flutter run (#113622) 2022-10-19 02:44:30 +00:00
android_project_migration_test.dart Switch to more reliable flutter.dev link destinations in the tool (#150587) 2024-06-26 23:30:39 +00:00
android_sdk_test.dart Native assets support for Android (#135148) 2023-12-07 16:29:11 +00:00
android_studio_test.dart [tool] fix android studio preview's version parsing (#156293) 2024-10-16 15:56:31 +00:00
android_studio_validator_test.dart [tool] In flutter doctor -v, warn when Android Studio version could not be detected. (#126395) 2023-06-01 14:51:30 +00:00
android_workflow_test.dart [tool] Guard more write/writeln calls on Process.stdin (#151146) 2024-07-23 19:27:52 +00:00
build_validation_test.dart Refactor BuildInfo to always require packageConfigPath (#150559) 2024-07-02 11:19:31 +02:00
deferred_components_gen_snapshot_validator_test.dart Revert "Speed up first asset load by encoding asset manifest in binary rather than JSON (#113637)" (#116662) 2022-12-07 17:29:05 +00:00
deferred_components_prebuild_validator_test.dart Fix typos (#121171) 2023-02-23 19:43:21 +00:00
gradle_errors_test.dart Agp Java Compatability Custom Error (#154142) 2024-08-29 10:06:48 -07:00
gradle_find_bundle_test.dart Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (#151433) 2024-07-10 21:37:26 +00:00
gradle_test.dart Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (#151433) 2024-07-10 21:37:26 +00:00
gradle_utils_test.dart Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (#151433) 2024-07-10 21:37:26 +00:00
java_test.dart have Java.version return null if java --version fails or cannot be run (#139614) 2023-12-06 23:13:17 +00:00
template_test.dart Adding 'is' to list of kotlin reserved keywords (#116299) 2023-01-06 00:10:07 +00:00