简体   繁体   English

Travis CI - Android项目构建失败

[英]Travis CI - Android Project Build Failing

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

My .travis.yml is: 我的.travis.yml是:

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

before_script:
  - chmod +x gradlew

The error is: 错误是:

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

Your gradlew file uses Windows style (CRLF) and Travis-ci runs on Linux that uses Unix style (LF). 您的gradlew文件使用Windows样式(CRLF),而Travis-ci在使用Unix样式(LF)的Linux上运行。

Copy the gradlew file from a trusted project as https://github.com/google/iosched/blob/master/gradlew 将受控项目中的gradlew文件复制为https://github.com/google/iosched/blob/master/gradlew

or change it using a text editor as vim and disable automatic conversion. 或使用文本编辑器将其更改为vim并禁用自动转换。 Read this answer: 阅读这个答案:

Source: Error with gradlew: /usr/bin/env: bash: No such file or directory 来源: gradlew错误:/ usr / bin / env:bash:没有这样的文件或目录

The problem's cause was that Git on Windows converted the line endings of gradlew from Unix style (LF) to Windows style (CRLF). 问题的原因是Windows上的Git将gradlew的行结尾从Unix风格(LF)转换为Windows风格(CRLF)。

You can turn off that automatic conversion using: 您可以使用以下命令关闭自动转换:

git config core.autocrlf false

Setting the line endings of gradlew back to Unix style fixed the problem. 将gradlew的行结尾设置回Unix样式可以解决问题。 In Vim this is done using: 在Vim中,这是使用:

set fileformat=unix

answered Mar 10 at 13:47 Matthias Braun 3月10日13:47 Matthias Braun回答

I found the answer here , It helped me 我在这里找到了答案,它帮助了我
and below is modification of this file 以下是文件的修改

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM