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

Exception: Gradle build failed with code 127 when there's no gradlew file generated before #1301

Closed
1 task done
fylyppo opened this issue May 22, 2023 · 3 comments
Closed
1 task done

Comments

@fylyppo
Copy link
Collaborator

fylyppo commented May 22, 2023

Is there an existing issue for this?

Steps to reproduce

Check run here: https://github.com/leancodepl/patrol/actions/runs/5046028831/jobs/9051026658#step:9:47

Actual results

Every Android builds fail after few seconds when using patrol on CI.

Logs

Logs
Verbose mode enabled. More logs will be printed.

Update available! 2.0.0-dev.1 → 1.1.10
Run patrol update to update

Received 10 test target(s)
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/android_app_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/example_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/notifications_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/open_app_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/open_quick_settings_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/permissions_many_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/service_cellular_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/service_dark_mode_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/service_wifi_test.dart
Received test target: /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/swipe_test.dart
Bundled 10 test(s) in /home/runner/work/patrol/patrol/packages/patrol/example/integration_test/test_bundle.dart
Received 5 --dart-define(s) (0 custom, 5 internal)
Received internal --dart-define: PATROL_WAIT=0
Received internal --dart-define: PATROL_APP_PACKAGE_NAME=pl.leancode.patrol.example
Received internal --dart-define: PATROL_ANDROID_APP_NAME=Patrol example
Received internal --dart-define: PATROL_TEST_LABEL=test_bundle.dart
Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false
• Building apk with entrypoint test_bundle.dart...
$ ./gradlew :app:assembleDebug -Ptarget=/home/runner/work/patrol/patrol/packages/patrol/example/integration_test/test_bundle.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9cGwubGVhbmNvZGUucGF0cm9sLmV4YW1wbGU=,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9UGF0cm9sIGV4YW1wbGU=,UEFUUk9MX1RFU1RfTEFCRUw9dGVzdF9idW5kbGUuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl
✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 127) (14ms)
Exception: Gradle build failed with code 127
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
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.
<asynchronous suspension>
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)
<asynchronous suspension>
Exception: Gradle build failed with code 127
#0      AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)
<asynchronous suspension>
#2      AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)
#1      DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)
<asynchronous suspension>
<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:[21](https://github.com/leancodepl/patrol/actions/runs/5046028831/jobs/9051026658#step:9:22)2:13)
<asynchronous suspension>
#5      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:313:18)
<asynchronous suspension>
#6      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:257:18)
<asynchronous suspension>
#7      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:66:20)
<asynchronous suspension>
#8      main (file:///home/runner/work/patrol/patrol/packages/patrol_cli/bin/main.dart:6:20)
<asynchronous suspension>

#3      BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:1[23](https://github.com/leancodepl/patrol/actions/runs/5046028831/jobs/9051026658#step:9:24):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:313:18)
<asynchronous suspension>
#6      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:[25](https://github.com/leancodepl/patrol/actions/runs/5046028831/jobs/9051026658#step:9:26)7:18)
<asynchronous suspension>
#7      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:66:20)
<asynchronous suspension>
#8      main (file:///home/runner/work/patrol/patrol/packages/patrol_cli/bin/main.dart:6:20)
<asynchronous suspension>

Proposal

patrol_cli should generate gradlew on its own when there isn't one.

@bartekpacia
Copy link
Contributor

bartekpacia commented May 22, 2023

This problem is already fixed in Flutter. See flutter/flutter#121904. It's not available on the stable channel yet, and won't be until the next major Flutter release (usually ~3 months).

Before it becomes available, you have to manually run flutter build apk --debug --flavor does-not-exist || true. The bad thing is that it actually tries to build the app, so it is slow.

When that PR is on the stable channel, to generate the gradlew file you'll do flutter build apk --config-only. It's very fast, just like flutter build ios --config-only, which has been available for a few years now.

@bas-ie
Copy link

bas-ie commented Oct 27, 2023

For anyone arriving at this issue more recently: the fix has arrived on Flutter stable, so you can do:

flutter build apk --config-only

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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants