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

I setup the codemagic.yaml file and write the test cases with patrol package in flutter app . I am facing the issue /bin/sh: ./gradlew: No such file or directory #1357

Closed
yroza opened this issue Jun 15, 2023 · 4 comments

Comments

@yroza
Copy link

yroza commented Jun 15, 2023

Steps to reproduce

I have write the codemagic.yaml for run the test cases in firebaseTestLab but it is failing with patrol-cli command.
I have also setup the flavor for dev , stg and prod types .

Here is my .yaml file
workflows: android_dev_workflow: name: workflow for integration testing instance_type: mac_mini_m1 environment: groups: - google_credentials flutter: 3.7.3 xcode: 14.2 cocoapods: default vars: FIREBASE_DEV_PROJECT: "hlp-dev" scripts: - name: get flutter packages script: | flutter pub get flutter pub run build_runner build --delete-conflicting-outputs dart pub global activate patrol_cli - name: create debug and test apk script: | patrol build android --target integration_test/hlp_test/hlp_test.dart --flavor dev - name: Run Firebase Test Lab Tests script: | set -ex echo $GCLOUD_DEV_KEY_FILE | base64 --decode > ./gcloud_dev_key_file.json gcloud auth activate-service-account --key-file=gcloud_dev_key_file.json gcloud --quite config set project $FIREBASE_DEV_PROJECT gcloud firebase test android run \ --type instrumentation \ --app build/app/outputs/apk/debug/app-debug.apk \ --test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk artifacts: - build/**/outputs/**/*.apk - build/**/outputs/**/*.aab - build/**/outputs/**/mapping.txt - flutter_drive.log publishing: email: recipients: - [email protected]
this patrol build android command is causing the issue

Actual results

Verbose mode enabled. More logs will be printed.

Received test target: /Users/builder/clone/integration_test/hlp_test/hlp_test.dart

Received Android flavor: dev

Received 5 --dart-define(s) (0 custom, 5 internal)

Received internal --dart-define: PATROL_WAIT=0

Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.hlp.user.dev

Received internal --dart-define: PATROL_ANDROID_APP_NAME=HLP Dev

Received internal --dart-define: PATROL_TEST_LABEL=hlp_test.dart

Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false

• Building apk with entrypoint hlp_test.dart...

$ ./gradlew :app:assembleDevDebug -Ptarget=/Users/builder/clone/integration_test/hlp_test/hlp_test.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLmhscC51c2VyLmRldg==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9SExQIERldg==,UEFUUk9MX1RFU1RfTEFCRUw9aGxwX3Rlc3QuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl

/bin/sh: ./gradlew: No such file or directory

✗ Failed to build apk with entrypoint hlp_test.dart (Gradle build failed with code 127) (9ms)

Exception: Gradle build failed with code 127

#0 AndroidTestBackend.build. (package:patrol_cli/src/android/android_test_backend.dart:67:9)

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/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.

Exception: Gradle build failed with code 127

#0 AndroidTestBackend.build. (package:patrol_cli/src/android/android_test_backend.dart:67:9)

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

Build failed :|

Step 4 script create debug and test apk exited with status code 1

Logs

Logs
Verbose mode enabled. More logs will be printed.

Received test target: /Users/builder/clone/integration_test/hlp_test/hlp_test.dart

Received Android flavor: dev

Received 5 --dart-define(s) (0 custom, 5 internal)

Received internal --dart-define: PATROL_WAIT=0

Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.hlp.user.dev

Received internal --dart-define: PATROL_ANDROID_APP_NAME=HLP Dev

Received internal --dart-define: PATROL_TEST_LABEL=hlp_test.dart

Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false

• Building apk with entrypoint hlp_test.dart...

$ ./gradlew :app:assembleDevDebug -Ptarget=/Users/builder/clone/integration_test/hlp_test/hlp_test.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLmhscC51c2VyLmRldg==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9SExQIERldg==,UEFUUk9MX1RFU1RfTEFCRUw9aGxwX3Rlc3QuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl

/bin/sh: ./gradlew: No such file or directory

✗ Failed to build apk with entrypoint hlp_test.dart (Gradle build failed with code 127) (9ms)

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>

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44: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:117: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:311:18)

<asynchronous suspension>

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

<asynchronous suspension>

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

<asynchronous suspension>

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/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 127

#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:44: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:117: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:311:18)

<asynchronous suspension>

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

<asynchronous suspension>

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

<asynchronous suspension>

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

<asynchronous suspension>

Build failed :|

Step 4 script `create debug and test apk` exited with status code 1```

</details>


### Patrol version

patrol: ^1.1.4


### Patrol Doctor output

<details>
<summary>
Patrol CLI version: 1.1.11
Program adb found in /Users/yash/Library/Android/sdk/platform-tools/adb
Env var $ANDROID_HOME set to /Users/yash/Users/yash/Library/Android/sdk
Program xcodebuild found in /usr/bin/xcodebuild
Program ideviceinstaller found in /Users/yash/homebrew/bin/ideviceinstaller
Program ios-deploy found in /Users/yash/homebrew/bin/ios-deploy```

</summary>

Patrol CLI version: 1.1.11
Program adb found in /Users/yash/Library/Android/sdk/platform-tools/adb
Env var $ANDROID_HOME set to /Users/yash/Users/yash/Library/Android/sdk
Program xcodebuild found in /usr/bin/xcodebuild
Program ideviceinstaller found in /Users/yash/homebrew/bin/ideviceinstaller
Program ios-deploy found in /Users/yash/homebrew/bin/ios-deploy```

Flutter Doctor output

Flutter Doctor output
[✓] Flutter (Channel stable, 3.7.4, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN)
    • Flutter version 3.7.4 on channel stable at /Users/yash/Documents/FlutterSdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b4bce91dd0 (4 months ago), 2023-02-21 09:50:50 +0800
    • Engine revision 248290d6d5
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/yash/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/yash/Users/yash/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /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.6b802.4-9586694)

[✓] VS Code (version 1.79.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.106

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@fylyppo
Copy link
Collaborator

fylyppo commented Jun 15, 2023

Hi, check #1301. I hope it'll help you.

@bartekpacia
Copy link
Contributor

Yeah, you have to generate the gradlew file first by running flutter build apk || true.

@yroza
Copy link
Author

yroza commented Jun 16, 2023

Thanks @fylyppo @bartekpacia . The solution is working .

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