appium / appium/appium-docker-android

JAVA_HOME ERROR

Open
#171 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
672
Forks
239
Avg merge
3d 3h
Merged PRs (30d)
5

Description

I've just cloned the repo , access to it with the terminal and run the command docker build -t "appium/appium:local" -f Appium/Dockerfile Appium

The error im getting is this one below
Testing in mac

[```
+] Building 0.7s (11/17) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 5.22kB 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:focal-20240530 0.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [ 1/13] FROM docker.io/library/ubuntu:focal-20240530@sha256:fa17826afb526a9fc7250e0fbcbfd18d03fe7a54849472f86879d8bf562c629e 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 307B 0.0s
=> CACHED [ 2/13] RUN apt-get -qqy update && apt dist-upgrade -y && apt-get -qqy --no-install-recommends install ca-certificates curl gnupg libg 0.0s
=> CACHED [ 3/13] RUN echo "UTC" > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata 0.0s
=> CACHED [ 4/13] RUN groupadd androidusr --gid 1301 && useradd androidusr --uid 1300 --gid 1301 --create-home --shell /b 0.0s
=> CACHED [ 5/13] WORKDIR /home/androidusr 0.0s
=> CACHED [ 6/13] RUN wget -O tools.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip && unzip tools.zip && rm tools.zip && 0.0s
=> ERROR [ 7/13] RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg && echo y | sdkmanager "platform-tools" && echo y | sdkmanager "build-tools;34 0.1s

[ 7/13] RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg && echo y | sdkmanager "platform-tools" && echo y | sdkmanager "build-tools;34.0.0" && mv ~/.android .android && chown -R 1300:1301 .android:
0.080
0.080 ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-11-openjdk-amd64
0.080
0.080 Please set the JAVA_HOME variable in your environment to match the
0.080 location of your Java installation.
0.080


3 warnings found (use --debug to expand):

  • UndefinedVar: Usage of undefined variable '$JAVA_HOME' (line 54)
  • LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 60)
  • JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 172)
    Dockerfile:100

99 | # https://askubuntu.com/questions/885658/android-sdk-repositories-cfg-could-not-be-loaded
100 | >>> RUN mkdir -p ~/.android &&
101 | >>> touch ~/.android/repositories.cfg &&
102 | >>> echo y | sdkmanager "platform-tools" &&
103 | >>> echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" &&
104 | >>> mv ~/.android .android &&
105 | >>> chown -R 1300:1301 .android
106 | ENV PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools

ERROR: failed to solve: process "/bin/sh -c mkdir -p ~/.android && touch ~/.android/repositories.cfg && echo y | sdkmanager "platform-tools" && echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" && mv ~/.android .android && chown -R 1300:1301 .android" did not complete successfully: exit code: 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect Appium/Dockerfile around lines 54 and 100-106, then reproduce the reported docker build command to confirm the JAVA_HOME failure during sdkmanager setup. Trace the Java installation and environment definitions in the Dockerfile; done means the image build reaches completion without the invalid JAVA_HOME error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, docker, shell
Domain
build-system, devops, mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.