我收到以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/travis/build/ir2pid/AndroidPOC2/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.1. Current version is 4.0.1. If using the gradle wrapper, try editing the distributionUrl in /home/travis/build/ir2pid/AndroidPOC2/gradle/wrapper/gradle-wrapper.properties to gradle-4.1-all.zip
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 40s
travis_time:end:06d6b207:start=1527276803217824665,finish=1527276844181358996,duration=40963534331
[0K
[31;1mThe command "gradle wrapper --gradle-version 4.1" failed and exited with 1 during .[0m
Your build has been stopped.
- 我上传了 gradlew、gradle-wrapper.properties、gradle-wrapper.jar
- 尝试让 gradlew 和 gradle-wrapper.jar 在 .travis.yml 中可写
- 甚至在 .travis.yml 脚本中安装了 gradle 4.4
gradle-wrapper.properties
#Fri May 25 21:05:26 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
.travis.yml
install: gradle wrapper --gradle-version 4.4
language: android
android:
components:
- tools
- platform-tools
# The BuildTools version used by your project
- build-tools-26.0.2
# The SDK version used to compile your project
- android-26
# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-26
before_script:
- chmod a+x gradlew
- chmod a+x gradle/wrapper/gradle-wrapper.jar
script: gradlew build
最佳答案
将这段代码与你的进行比较,注意:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
顶级gradle构建文件(build.gradle):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
//To get a Git project into your build
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
//To get a Git project into your build
maven { url 'https://jitpack.io' }
}
}
gradle-wrapper.properties:
#Mon Jan 1 13:51:26 PDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
关于android - 特拉维斯安卓构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50535904/