Travis ошибка сборки Android - PullRequest
0 голосов
/ 25 мая 2018

Я получаю следующую ошибку:

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.
  1. Я загрузил gradlew, gradle-wrapper.properties, gradle-wrapper.jar
  2. попытался сделать gradlew и gradle-wrapper.jar, доступный для записи в .travis.yml
  3. и даже установленный gradle 4.4 в сценарии .travis.yml

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

Ответы [ 3 ]

0 голосов
/ 22 февраля 2019

Я думаю, проблема в том, что вы не добавляете ./ до gradlew!

language: android
jdk: oraclejdk8
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

script: ./gradlew build
0 голосов
/ 22 февраля 2019

Это рабочая конфигурация того же проекта.

travis.yml

language: android

env:
  matrix:
    - ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a

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-19
    - android-26

    # Additional components
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - addon-google_apis-google-26
    - extra-android-support
    - sys-img-${ANDROID_ABI}-${ANDROID_TARGET}

script:
  - ./gradlew build 
  #- ./gradlew lint test connectedAndroidTest 
  #- ./gradlew build jacocoTestReport --stacktrace

gradle / wrapper / gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

уровень проекта .gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

уровень приложения .gradle android {

compileSdkVersion 26
defaultConfig {
    applicationId "xx.xx.xx"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
}
0 голосов
/ 16 февраля 2019

Сравните этот код с вашим, обратите внимание на:

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
...