leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
854 stars 127 forks source link

Unable to build Andorid Project #1987

Open masterwok opened 9 months ago

masterwok commented 9 months ago

Steps to reproduce

Application fails to build when using Patrol CLI on Andorid.

My project uses kotlin_version 1.7.10 and gradle distribution 7.5. I'm unable to migrate to Kotlin version 1.9.20 and distribution 8.4 due to a number of dependencies still needing to migrate to the latest build tools. However, my versions are in alignment when creating a new Flutter project.

Actual results

Patrol version 3.0.2+ returns the following error:

patrol test --target integration_test/example_test.dart --flavor staging --verbose

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Patrol version 3.0.1 or earlier returns the following error:

patrol test --target integration_test/example_test.dart --flavor staging --verbose

    > Could not open proj generic class cache for build file '/Users/jonathantrowbridge/.pub-cache/hosted/pub.dev/patrol-3.0.1/android/build.gradle' (/Users/jonathantrowbridge/.gradle/caches/7.5/scripts/d9gnyoqxmzlxg89jpeucpxvkl).
           > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64

Downgrading Java to 17.0.9 results in the following error:

export JAVA_HOME=`/usr/libexec/java_home -v 17.0.9`
patrol test --target integration_test/example_test.dart --flavor staging --verbose

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Logs

Logs ``` BUILD FAILED in 25s : : Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. : : You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. : : See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings : 628 actionable tasks: 12 executed, 616 up-to-date ✗ Failed to execute tests of apk with entrypoint test_bundle.dart on emulator-5554 (Gradle test execution failed with code 1) (26.1s) Exception: Gradle test execution failed with code 1 #0 AndroidTestBackend.execute. (package:patrol_cli/src/android/android_test_backend.dart:140:9) #1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7) #2 AndroidTestBackend.execute (package:patrol_cli/src/android/android_test_backend.dart:106:5) #3 TestCommand._execute (package:patrol_cli/src/commands/test.dart:272:7) #4 TestCommand.run (package:patrol_cli/src/commands/test.dart:169:23) #5 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #6 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:318:18) #7 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:262:18) #8 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:68:20) #9 main (file:///Users/jonathantrowbridge/.pub-cache/hosted/pub.dev/patrol_cli-2.3.1+1/bin/main.dart:6:20) See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it. Uninstalling com.coinme.coinme from sdk gphone64 arm64 Uninstalling com.coinme.coinme.test from sdk gphone64 arm64 ```

Patrol version

3.0.1 as well as 3.0.2+

Patrol Doctor output

Patrol Doctor output ``` Patrol CLI version: 2.3.1+1 Program adb found in /Users/jonathantrowbridge/Library/Android/sdk/platform-tools/adb Env var $ANDROID_HOME set to /Users/jonathantrowbridge/Library/Android/sdk Program xcodebuild found in /usr/bin/xcodebuild Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller ```

Flutter Doctor output

Flutter Doctor output ``` [✓] Flutter (Channel stable, 3.16.2, on macOS 14.1 23B74 darwin-arm64, locale en-US) • Flutter version 3.16.2 on channel stable at /Users/jonathantrowbridge/Library/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9e1c857886 (5 days ago), 2023-11-30 11:51:18 -0600 • Engine revision cf7a9d0800 • Dart version 3.2.2 • DevTools version 2.28.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/jonathantrowbridge/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/jonathantrowbridge/Library/Android/sdk • Java binary at: /Users/jonathantrowbridge/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.14.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Users/jonathantrowbridge/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 17.0.6+0-17.0.6b829.9-10027231) [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1) • IntelliJ at /Users/jonathantrowbridge/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 [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.5) • IntelliJ at /Users/jonathantrowbridge/Applications/IntelliJ IDEA Ultimate 2023.1.5.app • Flutter plugin version 75.1.3 • Dart plugin version 231.9392.3 [✓] VS Code (version 1.80.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.1 23B74 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.199 [✓] Network resources • All expected network resources are available. • No issues found! jonathantrowbridge@JonathansLaptop  ~  flutter doctor -v [✓] Flutter (Channel stable, 3.16.2, on macOS 14.1 23B74 darwin-arm64, locale en-US) • Flutter version 3.16.2 on channel stable at /Users/jonathantrowbridge/Library/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9e1c857886 (5 days ago), 2023-11-30 11:51:18 -0600 • Engine revision cf7a9d0800 • Dart version 3.2.2 • DevTools version 2.28.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/jonathantrowbridge/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/jonathantrowbridge/Library/Android/sdk • Java binary at: /Users/jonathantrowbridge/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.14.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Users/jonathantrowbridge/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 17.0.6+0-17.0.6b829.9-10027231) [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1) • IntelliJ at /Users/jonathantrowbridge/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 [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.5) • IntelliJ at /Users/jonathantrowbridge/Applications/IntelliJ IDEA Ultimate 2023.1.5.app • Flutter plugin version 76.3.3 • Dart plugin version 231.9409 [✓] VS Code (version 1.80.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 14.1 23B74 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.199 [✓] Network resources • All expected network resources are available. • No issues found! ```
lravihs commented 9 months ago

Same issue for me. Already working on jdk 17 even after changing to jdk 11 it's showing an error. It's better that the patrol developers should suggest the dependencies version in order to get rid of these kind of issues

Origogi commented 8 months ago

Same issue for me.