ReactiveCircus / android-emulator-runner

A GitHub Action for installing, configuring and running hardware-accelerated Android Emulators on macOS virtual machines.
Apache License 2.0
971 stars 192 forks source link

./gradlew: No such file or directory #142

Closed DinosaurierRex closed 3 years ago

DinosaurierRex commented 3 years ago

Hey, I was trying out the android-emulator-runner and came across the issue that the ./gradlew file cannot be accessed or is missing. Heres my YAML file: `... instrumentation_test: name: Instrumentation testsuite runs-on: macos-latest

steps:
- name: Checkout repository
  uses: actions/checkout@v2

- name: Set up JDK 11
  uses: actions/setup-java@v1
  with:
    java-version: 11

- name: Run Instrumentation tests
  uses: reactivecircus/android-emulator-runner@v2.15.0
  with:
    api-level: 29
    arch: x86_64
    script: ./gradlew connectedCheck

`

Where i encounter the following error: ` with: api-level: 29 arch: x86_64 script: ./gradlew connectedCheck target: default cores: 2 avd-name: test emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim disable-animations: true env: JAVA_HOME_11.0.10_x64: /Users/runner/hostedtoolcache/jdk/11.0.10/x64 JAVA_HOME: /Users/runner/hostedtoolcache/jdk/11.0.10/x64 JAVA_HOME_11_0_10_X64: /Users/runner/hostedtoolcache/jdk/11.0.10/x64 API level: 29 target: default CPU architecture: x86_64 Hardware profile: Cores: 2 SD card path or size: AVD name: test emulator options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim disable animations: true Script: ./gradlew connectedCheck Installing latest build tools, platform tools, and platform. /bin/sh -c \sdkmanager --install 'build-tools;30.0.3' platform-tools 'platforms;android-29' > /dev/null Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Installing latest emulator. /bin/sh -c \sdkmanager --install emulator > /dev/null Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Installing system images. /bin/sh -c \sdkmanager --install 'system-images;android-29;default;x86_64' > /dev/null Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') Creating AVD. /bin/sh -c \echo no | avdmanager create avd --force -n test --abi 'default/x86_64' --package 'system-images;android-29;default;x86_64' Loading local repository...
Warning: Observed package id 'ndk;21.4.7075529' in inconsistent location '/Users/runner/Library/Android/sdk/ndk-bundle' (Expected '/Users/runner/Library/Android/sdk/ndk/21.4.7075529') [========= ] 25% Loading local repository...
[========= ] 25% Fetch remote repository...
[=======================================] 100% Fetch remote repository...
sh to create a custom hardware profile? [no] [command]/bin/sh -c \printf 'hw.cpu.ncore=2 ' >> ~/.android/avd/test.avd/config.ini Starting emulator. /bin/sh -c \/Users/runner/Library/Android/sdk/emulator/emulator -avd test -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & handleCpuAcceleration: feature check for hvf emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037 cannot add library /Users/runner/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed added library /Users/runner/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib emulator: WARNING: Running on a system with less than 6 logical cores. Setting number of virtual cores to 1 emulator: feeding guest with passive gps data, in headless mode emulator: ### WARNING: /etc/localtime does not point to zoneinfo-compatible timezone name

emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local emulator: Cold boot: requested by the user Your emulator is out of date, please update by launching Android Studio:

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

emulator: ### WARNING: /etc/localtime does not point to zoneinfo-compatible timezone name

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed

/Users/runner/Library/Android/sdk/platform-tools/adb shell getprop sys.boot_completed 1 Emulator booted. /Users/runner/Library/Android/sdk/platform-tools/adb shell input keyevent 82 Disabling animations. /Users/runner/Library/Android/sdk/platform-tools/adb shell settings put global window_animation_scale 0.0 /Users/runner/Library/Android/sdk/platform-tools/adb shell settings put global transition_animation_scale 0.0 /Users/runner/Library/Android/sdk/platform-tools/adb shell settings put global animator_duration_scale 0.0 /bin/sh -c ./gradlew connectedCheck /bin/sh: ./gradlew: No such file or directory Error: The process '/bin/sh' failed with exit code 127 /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 emu kill OK: killing emulator, bye bye OK emulator: Discarding the changed state: command-line flag emulator: WARNING: Discarding the changed state (command-line flag). `

Is there anything Im missing ?

I already tried out all possible solutions from different repositories also using this action. Please help :)

ychescale9 commented 3 years ago

Is your root Gradle project in the root directory of the repo? If it's in a sub-directory, you can set working-directory to that sub-directory (where gradlew is).

DinosaurierRex commented 3 years ago

Hey, i actually found out that i could access it when typing ./directory/gradlew connectedCheck, but then i cannot access the task "connectedCheck". Somehow it states that the task "connectedCheck" is not accessible from root directory. I can run .../gradlew tasks --all to get the following:

` ------------------------------------------------------------ Tasks runnable from root project

Build Setup tasks

init - Initializes a new Gradle build. wrapper - Generates Gradle wrapper files.

Help tasks

buildEnvironment - Displays all buildscript dependencies declared in root project 'Team_27'. components - Displays the components produced by root project 'Team_27'. [incubating] dependencies - Displays all dependencies declared in root project 'Team_27'. dependencyInsight - Displays the insight into a specific dependency in root project 'Team_27'. dependentComponents - Displays the dependent components of components in root project 'Team_27'. [incubating] help - Displays a help message. model - Displays the configuration model of root project 'Team_27'. [incubating] outgoingVariants - Displays the outgoing variants of root project 'Team_27'. projects - Displays the sub-projects of root project 'Team_27'. properties - Displays the properties of root project 'Team_27'. tasks - Displays the tasks runnable from root project 'Team_27'.

Other tasks

prepareKotlinBuildScriptModel`

The strange thing here is that before i run the Instrumented tests i run commands for unit tests and lint, which are also not listed here ^^

ychescale9 commented 3 years ago

working-directory: directory

This will change your working directory to directory so you can use ./gradlew xxx in script.

DinosaurierRex commented 3 years ago

Ok, a big thank you @ychescale9 . This solved both of my problems 🥇