Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arm64 Architecture #166

Open
Legion2 opened this issue Mar 9, 2022 · 11 comments · May be fixed by #208
Open

Support arm64 Architecture #166

Legion2 opened this issue Mar 9, 2022 · 11 comments · May be fixed by #208

Comments

@Legion2
Copy link

Legion2 commented Mar 9, 2022

Please publish an arm64 compatible image to dockerhub.

@kaloudis
Copy link

Yes, please. Performance via emulation on M1 is terrible.

@kaelite
Copy link

kaelite commented Aug 13, 2022

Yes, please!

@Legion2
Copy link
Author

Legion2 commented Aug 23, 2022

Here is my try on creating a new docker image based on ubuntu:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

# set default build arguments
ARG SDK_VERSION=commandlinetools-linux-8092744_latest.zip
ARG ANDROID_BUILD_VERSION=31
ARG ANDROID_TOOLS_VERSION=31.0.0
ARG NDK_VERSION=21.4.7075529
ARG NODE_VERSION=16.x
ARG WATCHMAN_VERSION=4.9.0
ARG CMAKE_VERSION=3.18.1
ARG AVD_PACKAGE=system-images;android-30;google_apis;x86_64

# set default environment variables, please don't remove old env for compatibilty issue
ENV ADB_INSTALL_TIMEOUT=10
ENV ANDROID_HOME=/opt/android
ENV ANDROID_SDK_HOME=
ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
ENV ANDROID_NDK=${ANDROID_HOME}/ndk/$NDK_VERSION
ENV AVD_PACKAGE=${AVD_PACKAGE}
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV CMAKE_BIN_PATH=${ANDROID_HOME}/cmake/$CMAKE_VERSION/bin

ENV PATH=${ANDROID_NDK}:${CMAKE_BIN_PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${PATH}

# Install system dependencies
RUN apt update -qq && apt install -qq -y --no-install-recommends \
        apt-transport-https \
        curl \
        file \
        gcc \
        git \
        g++ \
        gnupg2 \
        libc++1-10 \
        libgl1 \
        libtcmalloc-minimal4 \
        make \
        openjdk-11-jdk-headless \
        openssh-client \
        patch \
        python3 \
        python3-distutils \
        rsync \
        ruby \
        ruby-dev \
        tzdata \
        unzip \
        sudo \
        ninja-build \
        zip \
        # Dev libraries requested by Hermes
        libicu-dev \
        # Emulator & video bridge dependencies
        libc6 \
        libdbus-1-3 \
        libfontconfig1 \
        libgcc1 \
        libpulse0 \
        libtinfo5 \
        libx11-6 \
        libxcb1 \
        libxdamage1 \
        libnss3 \
        libxcomposite1 \
        libxcursor1 \
        libxi6 \
        libxext6 \
        libxfixes3 \
        zlib1g \
        libgl1 \
        pulseaudio \
        socat \
    && gem install bundler \
    && rm -rf /var/lib/apt/lists/*;

# fix java home env var
RUN ln -s $(dirname -- $(dirname -- $(readlink -f /usr/bin/java))) /usr/lib/jvm/default-java
ENV JAVA_HOME=/usr/lib/jvm/default-java

# install nodejs and yarn packages from nodesource
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - \
    && apt-get update -qq \
    && apt-get install -qq -y --no-install-recommends nodejs \
    && npm i -g yarn \
    && rm -rf /var/lib/apt/lists/*

# Full reference at https://dl.google.com/android/repository/repository2-1.xml
# download and unpack android
# workaround buck clang version detection by symlinking
RUN curl -sS https://dl.google.com/android/repository/${SDK_VERSION} -o /tmp/sdk.zip \
    && mkdir -p ${ANDROID_HOME}/cmdline-tools \
    && unzip -q -d ${ANDROID_HOME}/cmdline-tools /tmp/sdk.zip \
    && mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
    && rm /tmp/sdk.zip \
    && yes | sdkmanager --licenses > /dev/null \
    && yes | sdkmanager "platform-tools" \
        "emulator" \
        "platforms;android-$ANDROID_BUILD_VERSION" \
        "build-tools;$ANDROID_TOOLS_VERSION" \
        "cmake;$CMAKE_VERSION" \
        "$AVD_PACKAGE" \
        "ndk;$NDK_VERSION" \
    && rm -rf ${ANDROID_HOME}/.android \
    && ln -s ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9 ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8

However the problem is, that the Android AVD emulator is not available for arm64 architecture and fails to install

@cortinico
Copy link
Member

that the Android AVD emulator is not available for arm64 architecture and fails to install

What's the failure message?

@Legion2
Copy link
Author

Legion2 commented Sep 3, 2022

I do not remember what the exact failure was, but I know it was some android tooling which did not work on arm64 and there were no workarounds, so I stopped working on it.

@Legion2
Copy link
Author

Legion2 commented Sep 3, 2022

@cortinico I searched my google history and found Warning: Failed to find package 'emulator' arm64 which should be the error I had back in march. It seems there are now workarounds for the problem https://stackoverflow.com/questions/71545278/install-build-tools-on-arm64-doesnt-work, if somebody wants to give it a shot.

@EyMaddis
Copy link

Did somebody achieve this?

@cortinico
Copy link
Member

This is still unsolved upstream.
Please go and star this issue on Google Issues' Tracker:
https://issuetracker.google.com/issues/225541805

@hamzafer
Copy link

Any updates on this?

@Alaa-Ben
Copy link

I'm interested in news about this too :D

@dgrezza

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants