Travis CI找不到local.properties

时间:2018-04-08 15:57:05

标签: android travis-ci

错误为local.properties (No such file or directory)

我的yml文件:

language: android

android:
  components:
    - platform-tools
    - build-tools-27.1.1
    - build-tools-27.0.3
    - android-27

before_install:
  - yes | sdkmanager "platforms;android-27"

我也试过了this解决方案但没有用。我无法上传local.properties因为它有局部变量。

2 个答案:

答案 0 :(得分:2)

我在this帖子上找到了答案。

添加build.gradle

的此代码末尾
if (project.rootProject.file('local.properties').exists()) {
    apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
    apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
}

答案 1 :(得分:0)

我遇到了同样的问题,找到了一个更简单的解决方案:

before_script:
  - touch local.properties

这将在运行脚本之前创建文件,但无需在项目中创建“假”文件并将其添加到项目中。

最初发布在https://stackoverflow.com/a/50113175/532368