Skip to content
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

Upgrade to Patrol 2.0 - Android build failed - Plugin [id: 'org.jlleitschuh.gradle.ktlint', version: '11.4.2'] was not found #1508

Closed
Naweap opened this issue Jul 11, 2023 · 8 comments
Labels
bug Something isn't working package: patrol Related to the patrol package (native automation, test bundling) platform: android Android is affected

Comments

@Naweap
Copy link

Naweap commented Jul 11, 2023

Steps to reproduce

  1. Follow the official Migration guide.
  2. Update Patrol to version 2.0.4.
  3. Update Patrol CLI to version 2.0.3.
  4. Build the artifacts through the following command:
    patrol build android --target .\integration_test\xxx\xxx_test.dart --dart-define=xxx=xxx --dart-define=xxx=xxx --verbose
  5. An exception is thrown from the Patrol source code.

Actual results

PS C:\dev\src\xxx\xxx> patrol build android --target .\integration_test\xxx\xxx_test.dart --dart-define=xxx=xxx --dart-define=xxx=xxx --verbose
You're using Patrol CLI 2.0, which has breaking changes.
Read the migration guide at https://patrol.leancode.co/v2.
Disable this warning by setting the PATROL_MIGRATED environment variable.

Verbose mode enabled. More logs will be printed.
Received 1 test target(s)
Received test target: C:\dev\src\xxx\xxx\.\integration_test\xxx\xxx_test.dart
Bundled 1 test(s) in C:\dev\src\xxx\xxx\integration_test\test_bundle.dart
Received 7 --dart-define(s) (2 custom, 5 internal)
Received custom --dart-define: xxx
Received custom --dart-define: xxx
Received internal --dart-define: PATROL_WAIT=0
Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.example.xxx
Received internal --dart-define: PATROL_ANDROID_APP_NAME=xxx     
Received internal --dart-define: PATROL_TEST_LABEL_ENABLED=true
Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false
• Building apk with entrypoint test_bundle.dart...
$ .\gradlew.bat :app:assembleDebug -Ptarget=C:\dev\src\xxx\xxx\integration_test\test_bundle.dart -Pdart-defines=xxxxxxxxxxx

        FAILURE: Build failed with an exception.

        * Where:
        Build file 'C:\Users\xxx\AppData\Local\Pub\Cache\hosted\pub.dev\patrol-2.0.4\android\build.gradle' line: 17

        * What went wrong:
        Plugin [id: 'org.jlleitschuh.gradle.ktlint', version: '11.4.2'] was not found in any of the following sources:

        - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)       
        - Plugin Repositories (could not resolve plugin artifact 'org.jlleitschuh.gradle.ktlint:org.jlleitschuh.gradle.ktlint.gradle.plugin:11.4.2')        
          Searched in the following repositories:
            Gradle Central Plugin Repository

        * 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 3s
        : 
        : 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
✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 1) (4.3s)
Exception: Gradle build failed with code 1
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
<asynchronous suspension>
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)  
<asynchronous suspension>
#2      AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)
<asynchronous suspension>
#3      BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:123:7)
<asynchronous suspension>
#4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)    
<asynchronous suspension>
#5      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:310:18)
<asynchronous suspension>
#6      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:254:18)
<asynchronous suspension>
#7      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:72:20)
<asynchronous suspension>
#8      main (file:///C:/Users/xxx/AppData/Local/Pub/Cache/hosted/pub.dev/patrol_cli-2.0.3/bin/main.dart:6:20)
<asynchronous suspension>

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.       
Exception: Gradle build failed with code 1
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
<asynchronous suspension>
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)  
<asynchronous suspension>
#2      AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)
<asynchronous suspension>
#3      BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:123:7)
<asynchronous suspension>
#4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)    
<asynchronous suspension>
#5      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:310:18)
<asynchronous suspension>
#6      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:254:18)
<asynchronous suspension>
#7      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:72:20)
<asynchronous suspension>
#8      main (file:///C:/Users/xxx/AppData/Local/Pub/Cache/hosted/pub.dev/patrol_cli-2.0.3/bin/main.dart:6:20)
<asynchronous suspension>

Logs

none

Patrol version

patrol: ^2.0.4

Patrol Doctor output

Patrol Doctor output
PS C:\dev\src\xxx\xxx> patrol --version
You're using Patrol CLI 2.0, which has breaking changes.
Read the migration guide at https://patrol.leancode.co/v2.
Disable this warning by setting the PATROL_MIGRATED environment variable.     

patrol_cli v2.0.3

Flutter Doctor output

Flutter Doctor output
PS C:\WINDOWS\system32> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.10.4, on Microsoft Windows [Version 10.0.19045.3086], locale en-GB)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.2)
[√] Android Studio (version 2020.3)
[√] IntelliJ IDEA Community Edition (version 2021.2)
[√] VS Code
[√] VS Code, 64-bit edition (version 1.80.0)
[√] Connected device (3 available)
[√] Network resources
@bartekpacia
Copy link
Contributor

bartekpacia commented Jul 11, 2023

Hi @Naweap, sorry for these cryptic build failures. After some investigation, I found out that we have a bug in our Gradle buildscripts.

I made PR #1509, will release it soon and I hope it'll fix the failures for you.

@Naweap
Copy link
Author

Naweap commented Jul 12, 2023

Hi @Naweap, sorry for these cryptic build failures. After some investigation, I found out that we have a bug in our Gradle buildscripts.

I made PR #1509, will release it soon and I hope it'll fix the failures for you.

Thanks for your quick reply.
Looking forward to get it released!

@bartekpacia
Copy link
Contributor

#1509 was merged and released in patrol v2.0.5. I'm gonna optimistically close this issue.

@bartekpacia bartekpacia added bug Something isn't working package: patrol Related to the patrol package (native automation, test bundling) platform: android Android is affected labels Jul 12, 2023
@Naweap
Copy link
Author

Naweap commented Jul 12, 2023

Hi @bartekpacia, I just installed the new version and ran the same command again.
Migration related changes and configurations remain the same.

Now the following exception is thrown:

        FAILURE: Build failed with an exception.

        * What went wrong:
        A problem occurred configuring project ':patrol'.
        > Could not open cp_proj generic class cache for build file 'C:\Users\xxx\AppData\Local\Pub\Cache\hosted\pub.dev\patrol-2.0.6\android\build.gradle' (C:\Users\xxx\.gradle\caches\7.5\scripts\apzse0axp8xlarlxshyrv4xty).
           > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
        > Failed to notify project evaluation listener.
           > Could not get unknown property 'android' for project ':patrol' of type org.gradle.api.Project.
           > Could not find method implementation() for arguments [project ':integration_test'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
           > Could not get unknown property 'android' for project ':patrol' of type org.gradle.api.Project.

Thanks in advance for your support.

@bartekpacia
Copy link
Contributor

Oops, sorry @Naweap!

This looks like a different issue - could you create it? I'll try to prioritize fixing it.

@Naweap
Copy link
Author

Naweap commented Jul 12, 2023

Oops, sorry @Naweap!

This looks like a different issue - could you create it? I'll try to prioritize fixing it.

Will do it during the coming hours.

@Naweap
Copy link
Author

Naweap commented Jul 12, 2023

@bartekpacia Here it is ! #1517

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: patrol Related to the patrol package (native automation, test bundling) platform: android Android is affected
Projects
None yet
Development

No branches or pull requests

2 participants