执行失败的任务':app:connecteddebugandroidtest'。 gitlab ci

发布于 2025-02-03 11:34:48 字数 4559 浏览 0 评论 0原文

我正在使用gitlab ci测试我的APK,并且要做到这一点,我需要一个虚拟设备,以便我可以测试仪器测试以使用fastlane命令进行屏幕截图,但是当我尝试运行./gradlew connectedandroidtest时,使用此管道中的Gitlab中的gitectedAndroidTest,

   image: mingc/android-build-box:latest

stages:
  - ui-test
  - build
  - test

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"


before_script:
  - chmod +x ./gradlew
  - gem install fastlane
  - export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
build:
 
  stage: build
  script:
    -  fastlane  build
  artifacts:
    paths:
      - "app/build/outputs/"
  tags:
    - docker
ui-test:
  stage: ui-test
  script:
    - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
    # Add missing folder to the PATH, to use sdkmanager
    - export ADB_INSTALL_TIMEOUT=30
    - export USE_SDK_WRAPPER=True
    # Insall and run emulator
    - sdkmanager "platform-tools" "platforms;android-27" "emulator"

    - sdkmanager "system-images;android-27;google_apis;arm64-v8a"
    - adb devices
    # Create an ARM-based emulator AVD with 250 MB SD car
    - echo "no" | avdmanager create avd -n Android_7.0_API_24 -k "system-images;android-27;google_apis;arm64-v8a" -c 250M --force

    # Check the image is properly created and available to run
    - emulator -list-avds
    - emulator -avd  Android_7.0_API_24 -no-audio -no-window -gpu off &
    - adb wait-for-device devices
    - echo "Emulator is ready"
    - adb devices
    - export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
    - ./gradlew connectedAndroidTest
    - fastlane  screenshots

  tags:
    - docker
test:
  stage: test
  script:
    - fastlane  test
  tags:
    - docker
            

我得到了此错误即使我在Android Studio运行该测试时没有

[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
    at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
    at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
    at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
    at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
    at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
    at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
> Task :app:connectedDebugAndroidTest
Skipping device 'Android_7.0_API_24(AVD)' for 'app:': Unknown API Level
 > : No compatible devices connected.[TestRunner] FAILED 
Found 1 connected device(s), 0 of which were compatible.
> Task :app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
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.2/userguide/command_line_interface.html#sec:command_line_warnings
61 actionable tasks: 61 executed
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///builds/chaimae.bousaid/myapplication/app/build/reports/androidTests/connected/index.html
* 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 6m 24s
Cleaning up project directory and file based variables
00:32
ERROR: Job failed: exit code 1

错误

i am using gitlab ci to test my apk and to do that i needed a virtual device so i can test my instrumented test to take screenshots with fastlane commande but when i try to run ./gradlew connectedAndroidTest in gitlab using this pipeline

   image: mingc/android-build-box:latest

stages:
  - ui-test
  - build
  - test

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"


before_script:
  - chmod +x ./gradlew
  - gem install fastlane
  - export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
build:
 
  stage: build
  script:
    -  fastlane  build
  artifacts:
    paths:
      - "app/build/outputs/"
  tags:
    - docker
ui-test:
  stage: ui-test
  script:
    - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
    # Add missing folder to the PATH, to use sdkmanager
    - export ADB_INSTALL_TIMEOUT=30
    - export USE_SDK_WRAPPER=True
    # Insall and run emulator
    - sdkmanager "platform-tools" "platforms;android-27" "emulator"

    - sdkmanager "system-images;android-27;google_apis;arm64-v8a"
    - adb devices
    # Create an ARM-based emulator AVD with 250 MB SD car
    - echo "no" | avdmanager create avd -n Android_7.0_API_24 -k "system-images;android-27;google_apis;arm64-v8a" -c 250M --force

    # Check the image is properly created and available to run
    - emulator -list-avds
    - emulator -avd  Android_7.0_API_24 -no-audio -no-window -gpu off &
    - adb wait-for-device devices
    - echo "Emulator is ready"
    - adb devices
    - export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
    - ./gradlew connectedAndroidTest
    - fastlane  screenshots

  tags:
    - docker
test:
  stage: test
  script:
    - fastlane  test
  tags:
    - docker
            

I got this error even if this test got no error while i run it in android studio

[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
    at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
    at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
    at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
    at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
    at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
    at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
    at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
> Task :app:connectedDebugAndroidTest
Skipping device 'Android_7.0_API_24(AVD)' for 'app:': Unknown API Level
 > : No compatible devices connected.[TestRunner] FAILED 
Found 1 connected device(s), 0 of which were compatible.
> Task :app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
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.2/userguide/command_line_interface.html#sec:command_line_warnings
61 actionable tasks: 61 executed
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///builds/chaimae.bousaid/myapplication/app/build/reports/androidTests/connected/index.html
* 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 6m 24s
Cleaning up project directory and file based variables
00:32
ERROR: Job failed: exit code 1

does any one have any idea to solve it i have been solving this error for a mounth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文