I am running git-lab server with Ubuntu 14 I am trying to compile a build on git-lab Ci but for some reasons I keep getting the same error over and over again:
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-7-openjdk-amd64/jre Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
No matter how I change the path of JAVA_HOME it is always the same results. I have 4 folders inside the JVM folder:
java-8-oracle
java-7-openjdk-amd64
java-1.7.0-openjdk-amd64
default-java
But again no matter which directory I set the path to it is always the same result.
Here is my .gitlab-ci.yml
file:
before_script:
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
- export ANDROID_HOME="/opt/android-sdk"
- chmod +x gradlew
dev:
script:
- ./gradlew assembleDebug
What could be the cause of this error?
Try to change your .gitlab-ci.yml
to this:
before_script:
- export ANDROID_HOME="/opt/android-sdk"
- export JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-amd64"
- chmod +x gradlew
dev:
script:
- ./gradlew assembleDebug
You can try removing chmod +x gradlew
from before_script
and move it to the main script
:
before_script:
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
- export ANDROID_HOME="/opt/android-sdk"
dev:
script:
- chmod +x ./gradlew
- ./gradlew assembleDebug
Reference: https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/#comment-4440925341
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With