Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis fails to build Android project, no local.properties

Here is the thing. I've built my project on the Travis CI several times, but got the same problem every time.

The error log:

What went wrong: A problem occurred evaluating root project 'LiteReader'. /home/travis/build/Mindjet/LiteReader/local.properties (No such file or directory)

It's true that the project I uploaded has no local.properties, I've excluded it because it contains information specific to local configuration.

It's my .travis.yml

language: android
cache: bundler

android:
  components:
    - tools
    - build-tools-25.0.2
    - android-25
    - extra-android-m2repository
    - extra-android-support

before_install:
  - chmod +x gradlew

script:
      ./gradlew checkstyle build

How can I solve this problem? Please help, Thanks.

like image 443
Mindjet Avatar asked Feb 01 '26 10:02

Mindjet


2 Answers

A bit late to the party, but I ran into the same issue and found a simpler solution:

before_script:
  - touch local.properties

This will create the file, before running the script, but without the need to create and add a "fake" file into your project.

like image 115
Mokkun Avatar answered Feb 03 '26 00:02

Mokkun


I have the same problem with GitHub Actions CI

The issue is /local.properties (No such file or directory) and it is solved in this way:

- name: Touch local properties
  run: touch local.properties

- name: Add Api Key
  run: echo "apiKey=\"\"" >> local.properties

This will create the file and add your variables (ex: empty API key) to it Then add the code to run the test and it will pass without errors.

- name: Run Tests
  run: ./gradlew test
like image 38
Marwa Eltayeb Avatar answered Feb 02 '26 22:02

Marwa Eltayeb