【问题标题】:Travis CI - Android Project Build FailingTravis CI - Android 项目构建失败
【发布时间】:2014-11-25 08:50:07
【问题描述】:

参考版本:https://travis-ci.org/ameer1234567890/Cevapr/builds/42053662

我的 .travis.yml 是:

language: android
android:
  components:
    - tools
    - build-tools-19.1.0
    - android-19
    - platform-tools

before_script:
  - chmod +x gradlew

错误是:

./gradlew build connectedCheck
: No such file or directory
The command "./gradlew build connectedCheck" exited with 127.
Done. Your build exited with 1.

【问题讨论】:

    标签: android build gradle travis-ci


    【解决方案1】:

    您的 gradlew 文件使用 Windows 样式 (CRLF),而 Travis-ci 在使用 Unix 样式 (LF) 的 Linux 上运行。

    将受信任项目中的 gradlew 文件复制为 https://github.com/google/iosched/blob/master/gradlew

    或使用文本编辑器如 vim 更改它并禁用自动转换。阅读此答案:

    来源:Error with gradlew: /usr/bin/env: bash: No such file or directory

    问题的原因是 Windows 上的 Git 转换了行尾 从 Unix 风格 (LF) 到 Windows 风格 (CRLF) 的 gradlew。

    您可以使用以下方法关闭自动转换:

    git config core.autocrlf false

    将 gradlew 的行尾设置回 Unix 样式修复了 问题。在 Vim 中,这是使用:

    set fileformat=unix

    在 3 月 10 日 13:47 Matthias Braun 回答

    【讨论】:

    【解决方案2】:

    我找到了答案here,它帮助了我
    以下是this文件的修改

    language: android
    android:
      components:
        - tools
        - build-tools-24.0.1
        - android-24
        - platform-tools
        - extra-android-support # because I'm use support library
        - extra-android-m2repository # because I'm use support library
      licenses:
        - '.+'
    
    sudo: required
    
    jdk:
      - oraclejdk8
    
    install: true
    
    before_script:
      - chmod +x gradlew
    
    script:
      - ./gradlew assembleRelease --stacktrace
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多