gpt4 book ai didi

android - 在CircleCI中构建android应用程序测试时找不到gradlew

转载 作者:行者123 更新时间:2023-12-03 05:50:20 32 4
gpt4 key购买 nike

我有一个Android项目,我想通过在CircleCI 2.0中进行部署来构建和测试。

执行构建时,出现错误

*$#!bin/bash -eo pipefail
.gradlew androidDependencies
/bin/bash: ./gradlew: No such file or directory
Exited with Code 127*

version: 2
jobs:
build:
working_directory: ~/AndroidDemo
docker:
# Android the primary container
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
#- restore_cache:
# key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
# - save_cache:
# paths:
# - ~/.gradle
# key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}

#- run:
# name: Run UnitTest
# command: ./gradlew testDemoDebugUnitTest
- run:
name: Setup emulator
command: sdkmanager "system-images;android-24;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a"
- run:
name: Launch emulator
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel auto -verbose
background: true
- run:
name: Wait emulator
command: |
# wait for it to have booted
circle-android wait-for-boot
# unlock the emulator screen
sleep 30
adb shell input keyevent 82
- run:
name: Run EspressoTests
command: ./gradlew connectedDemoDebugAndroidTest
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results

我已经在config.yml文件中设置了工作目录

// AndroidDemo是我的项目所在的位置

working_directory:〜/ AndroidDemo

最佳答案

由于不支持1.0,我尝试重构配置文件并移至Circle CI 2.0。

circle.yml文件应放在CircleCI应该克隆的根目录下。

权限应授予gradlew。

chmod +x gradlew

测试下:执行gradlew如下:
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=com.example.android_demo.MyTestsTestSuite connectedAndroidTest -PdisablePreDex

这对我有用。

关于android - 在CircleCI中构建android应用程序测试时找不到gradlew,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48188612/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com