Mohsen Mohsen - 6 months ago 34
Android Question

How to setup CircleCI environment JAVA7_HOME for RetroLambda

I am using retrolambda in my Android application, and using circleci.com as continuous integration for my github repo.

the problem is I have configured my local mac environment for Java_Home and Java7_Home, and everything is okay, but I don't know how to config circleci yml file for this problem.

here is my application repo:

https://github.com/mmirhoseini/weather_app


here is my local configurations on .bash_profile file:

export JAVA_HOME=`/usr/libexec/java_home`
export JAVA7_HOME=`/usr/libexec/java_home -v 1.7`


this is my circleci.yml file:

#
# Build configuration for Circle CI
#

general:
artifacts:
- /home/ubuntu/weather_app/app/build/outputs/apk/

machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux

java:
version: openjdk8

dependencies:
override:
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.3,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
override:
- (./gradlew assemble):
timeout: 360

- (./gradlew test):
timeout: 360


and here is the circleci error log:

> Building 10%When running gradle with java 8, you must set the path to the old jdk, either with property retrolambda.oldJdk or environment variable JAVA5_HOME/JAVA6_HOME/JAVA7_HOME


please help...

Answer

finally problem solved, I prepared environment by downloading older java version and setting Java6_home and after that build and run my tests.

here is my circleci.yml file:

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/weather_app/app/build/outputs/apk/
        - /usr/lib/jvm/

machine:
    environment:
        ANDROID_HOME: /usr/local/android-sdk-linux
        JAVA6_HOME: /usr/lib/jvm/java-6-openjdk-amd64

    java:
      version: openjdk8

dependencies:
    override:
        - echo y | sudo apt-get update
        - echo y | sudo apt-get install libpango-1.0-0
        - echo y | sudo apt-get install openjdk-6-jre

        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.3,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
    override:
        - (./gradlew assemble):
            timeout: 360

        - (./gradlew test):
            timeout: 360