[英]Travis-CI Build error android app
我正在尝试使用Travis-CI构建我的应用程序。
但是由于某种原因,它不断出现此错误:
The command "./gradlew build connectedCheck" exited with 1.
这是我的.travis.yml中的内容:
language: android
before_install:
- chmod +x gradlew
android:
components:
- tools
- platform-tools
- build-tools-27.1.1
- android-27
script:
- ./gradlew build connectedCheck
在这里,您可以链接到我的Travis版本:
https://travis-ci.org/Luuk2016/WeatherApp-Android/jobs/371162957
和我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.district420.weatherapp"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
希望有人可以帮助我
由于您尚未接受Android SDK软件包的许可证,因此构建失败。 将此行添加到您的travis.yml。
licenses:
- '.+'
编辑:
由于您的构建现在由于错误“未连接的设备”而失败。 您必须在travis中创建一个仿真器并在其上运行检测测试。 在travis.yml文件中也添加这些行。
env:
global:
- ANDROID_API_LEVEL=27
- ANDROID_EMULATOR_LEVEL=21
- ANDROID_BUILD_TOOLS_VERSION=27.0.3
- ANDROID_ABI=armeabi-v7a
- ANDROID_TAG=google_apis
- ADB_INSTALL_TIMEOUT=20
将这些行添加到travis文件的components部分。
- android-$ANDROID_EMULATOR_LEVEL
- sys-img-armeabi-v7a-google_apis-$ANDROID_EMULATOR_LEVEL
也添加这些行
before_script:
# Create and start emulator.
- echo no | android create avd --force -n test -t "android-"$ANDROID_EMULATOR_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
- emulator -avd test -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
另外,将其添加为travis.yml的第一行
sudo: false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.