Skip to content

Support arm64 Architecture #166

@Legion2

Description

@Legion2

Please publish an arm64 compatible image to dockerhub.

Activity

kaloudis

kaloudis commented on Aug 10, 2022

@kaloudis

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

kaelite

kaelite commented on Aug 13, 2022

@kaelite

Yes, please!

Legion2

Legion2 commented on Aug 23, 2022

@Legion2
Author

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

cortinico commented on Sep 1, 2022

@cortinico
Member

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

What's the failure message?

Legion2

Legion2 commented on Sep 3, 2022

@Legion2
Author

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

Legion2 commented on Sep 3, 2022

@Legion2
Author

@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

EyMaddis commented on Nov 18, 2022

@EyMaddis

Did somebody achieve this?

cortinico

cortinico commented on Nov 18, 2022

@cortinico
Member

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

hamzafer

hamzafer commented on Jan 13, 2023

@hamzafer

Any updates on this?

Alaa-Ben

Alaa-Ben commented on Jan 27, 2023

@Alaa-Ben

I'm interested in news about this too :D

dgrezza

dgrezza commented on Feb 20, 2023

@dgrezza
linked a pull request that will close this issue on Jun 26, 2023
cw-sarvesh

cw-sarvesh commented on Jun 3, 2025

@cw-sarvesh

any update on this, still facing this issue in 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @EyMaddis@kaloudis@cortinico@kaelite@Legion2

      Issue actions

        Support arm64 Architecture · Issue #166 · react-native-community/docker-android