Foundation-Devices / envoy

Envoy: The perfect companion app for your Passport.
https://foundationdevices.com/envoy
35 stars 9 forks source link

Failure to build app (APK/AAB) from source #1206

Open basantagoswami opened 2 weeks ago

basantagoswami commented 2 weeks ago

What mobile OS are you using?

Android

Please provide details on the device you experienced the bug on

No response

Description

I am trying to build the app from source as part of walletscrutiny.com's reproducibility tests. I checked out the latest release tag (v1.6.2) and tried out all the different approached outlined in the README, but failed to compile the code.

BUILDING MANUALLY

  1. I already had Flutter and Rust installed on my system.

Flutter version:

$ flutter --version
Flutter 3.22.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5dcb86f68f (5 weeks ago) • 2024-05-09 07:39:20 -0500
Engine • revision f6344b75dc
Tools • Dart 3.4.0 • DevTools 2.34.3

Rust version:

$ rustc --version
rustc 1.69.0 (84c898d65 2023-04-16)
  1. Ran the three command listed on the README:
    
    $ ANDROID_SDK_ROOT=~/Android/Sdk

$ ./build_ffi_android.sh info: syncing channel updates for '1.69.0-x86_64-unknown-linux-gnu'

1.69.0-x86_64-unknown-linux-gnu unchanged - rustc 1.69.0 (84c898d65 2023-04-16)

info: checking for self-update info: component 'rust-std' for target 'aarch64-linux-android' is up to date Finished dev [unoptimized + debuginfo] target(s) in 0.17s Finished release [optimized + debuginfo] target(s) in 0.18s

$ flutter build apk Resolving dependencies... (7.7s) Note: intl is pinned to version 0.19.0 by flutter_localizations from the flutter SDK. See https://dart.dev/go/sdk-version-pinning for details.

Because envoy depends on flutter_localizations from sdk which depends on intl 0.19.0, intl 0.19.0 is required. So, because envoy depends on intl ^0.18.0, version solving failed.

As you can see this approach fails because of some version mismatch.

**BUILDING USING DOCKER AND JUST**

It fails because of some permission related issues with the steps in the Dockerfile

$ just docker-build-android; docker build -t envoy . Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. STEP 1/24: FROM ubuntu:22.04 STEP 2/24: MAINTAINER Igor Cota igor@foundation.xyz --> Using cache dde49f7e7557ff4f1a4aeaf24b55535231f613bf0610c313619a0250f204e7c8 --> dde49f7e755 STEP 3/24: WORKDIR /root --> Using cache 9380d410c5bc857facfb1c812b6dbaa91d54f10f2c5131668ae846a60c985dab --> 9380d410c5b STEP 4/24: ENV TZ=America/New_York --> Using cache 46062c1a5d10e8f4ea9ee1b96280a70633937d481f603255bd8936f43c4872de --> 46062c1a5d1 STEP 5/24: ARG DEBIAN_FRONTEND=noninteractive --> Using cache 85957e39db9df2487d454108006fec955bf6d0914579d6bb34f0984292d99a2c --> 85957e39db9 STEP 6/24: RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends postgresql curl build-essential libssl-dev pkg-config libpq-dev git unzip xz-utils zip libglu1-mesa openjdk-8-jdk openjdk-11-jdk wget python2 autoconf clang cmake ninja-build libgtk-3-0 libgtk-3-dev v4l2loopback-dkms v4l2loopback-utils libzbar-dev libzbar0 libzbargtk-dev libjsoncpp-dev libsecret-1-dev libsecret-1-0 ffmpeg xvfb xdotool x11-utils libstdc++-12-dev llvm-14 libsdl2-dev libclang1-14 libtool sudo libusb-1.0-0-dev python3-virtualenv xorg xdg-user-dirs xterm tesseract-ocr && apt clean && rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/* --> Using cache f39ee781d8c95bde240c1ee792454316c6037532bcff2c29d7c56416e2307f1f --> f39ee781d8c STEP 7/24: RUN update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64 --> Using cache d65f198697b9f74ede82ec82fc8274f9622db4993313251e6da3533a8aa98e96 --> d65f198697b STEP 8/24: RUN mkdir -p Android/sdk --> Using cache 3d1fa9c6b01b6e0535b9675783b21fd5924578a189ff1ed5ff06f6083ceb238f --> 3d1fa9c6b01 STEP 9/24: ENV ANDROID_SDK_ROOT /root/Android/sdk --> Using cache 55e9940d9c44b85348cef3d5388b01f917bf1a565e1af3a314e9f8fd2868b801 --> 55e9940d9c4 STEP 10/24: RUN mkdir -p .android && touch .android/repositories.cfg && wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip sdk-tools.zip && rm sdk-tools.zip --> Using cache 0d7bf8adf48f284a2334bd0a0921c4fe9b593fa754b9d8b8c5720527cbcbb8ac --> 0d7bf8adf48 STEP 11/24: RUN mv tools Android/sdk/tools --> Using cache e1b5e35eef6495bd954c87ef38fb4f576162e92273fd0b24916118149998930d --> e1b5e35eef6 STEP 12/24: RUN cd Android/sdk/tools/bin && yes | ./sdkmanager --licenses && ./sdkmanager "build-tools;30.0.2" "platform-tools" "cmdline-tools;latest" "ndk;24.0.8215888" --> Using cache 66b06c2408b742d8505c6858e9c0f7d09b19a4cd88705222e54815090db91905 --> 66b06c2408b STEP 13/24: ENV PATH "$PATH:/root/Android/sdk/platform-tools" --> Using cache e2b94bad574a6ccf9d35ec17f95b89c8a920f59e726a15acc5efb1dbd6e69deb --> e2b94bad574 STEP 14/24: RUN update-java-alternatives --set /usr/lib/jvm/java-1.11.0-openjdk-amd64 --> Using cache ac6ec070c33560e03f0ad21de937c13adf8f584d3ecc0af52394224e0ca4788f --> ac6ec070c33 STEP 15/24: RUN git clone https://github.com/flutter/flutter.git --> Using cache 3aa2a838b1310eba91b320acf32e8bd220df8e977e24ec4eb58af7eaf92f5c20 --> 3aa2a838b13 STEP 16/24: ENV PATH "$PATH:/root/flutter/bin" --> Using cache daa1d5d750dde3c3512dfa172a2011fe46280c507cf099bf465c7db44e89cc80 --> daa1d5d750d STEP 17/24: RUN flutter channel stable && cd flutter && git checkout 3.16.3 && flutter config --enable-linux-desktop Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges. / 📎 Downloading Linux x64 Dart SDK from Flutter engine 1cdbebee19012cee6cfaf67a434e3a6fcbc4682b... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 202M 100 202M 0 0 14.5M 0 0:00:13 0:00:13 --:--:-- 16.9M Building flutter tool... Resolving dependencies... Downloading packages... Got dependencies. Downloading Material fonts... 358ms Downloading Gradle Wrapper... 16ms /usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: Exiting with failure status due to previous errors Downloading Gradle Wrapper... 15ms /usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument /usr/bin/tar: Exiting with failure status due to previous errors Flutter could not download and/or extract https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz. Ensure you have network connectivity and all of the required dependencies listed at flutter.dev/setup. The original exception was: ProcessException: The command failed with exit code 2 Command: tar -xzf /root/flutter/bin/cache/downloads/storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz -C /root/flutter/bin/cache/artifacts/gradle_wrapper. Error: error building at STEP "RUN flutter channel stable && cd flutter && git checkout 3.16.3 && flutter config --enable-linux-desktop": error while running runtime: exit status 1 error: Recipe docker-build failed on line 9 with exit code 125


**MY OWN APPROACH**

1. I modified the Dockerfile to fix some of the file permission related issues

```Dockerfile
# SPDX-FileCopyrightText: 2022 Foundation Devices Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later

FROM ubuntu:22.04

MAINTAINER Igor Cota <igor@foundation.xyz>

# Create a non-root user
RUN useradd -m -s /bin/bash flutteruser

WORKDIR /home/flutteruser

ENV TZ=America/New_York
ARG DEBIAN_FRONTEND=noninteractive

# Update all packages on the build host and install only necessary packages for building and clear cache as root
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
    postgresql \
    curl \
    build-essential \
    libssl-dev \
    pkg-config \
    libpq-dev \
    git \
    unzip \
    xz-utils \
    zip \
    libglu1-mesa \
    openjdk-8-jdk \
    openjdk-11-jdk \
    wget \
    python2 \
    autoconf \
    clang \
    cmake \
    ninja-build \
    libgtk-3-0 \
    libgtk-3-dev \
    v4l2loopback-dkms \
    v4l2loopback-utils \
    libzbar-dev \
    libzbar0 \
    libzbargtk-dev \
    libjsoncpp-dev \
    libsecret-1-dev \
    libsecret-1-0 \
    ffmpeg \
    xvfb \
    xdotool \
    x11-utils \
    libstdc++-12-dev \
    llvm-14 \
    libsdl2-dev \
    libclang1-14 \
    libtool \
    sudo \
    libusb-1.0-0-dev \
    python3-virtualenv \
    xorg \
    xdg-user-dirs \
    xterm tesseract-ocr \
    && apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Android SDK as root
RUN update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64
RUN mkdir -p /home/flutteruser/Android/sdk
ENV ANDROID_SDK_ROOT /home/flutteruser/Android/sdk
RUN mkdir -p /home/flutteruser/.android && touch /home/flutteruser/.android/repositories.cfg && wget -O /home/flutteruser/sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip /home/flutteruser/sdk-tools.zip -d /home/flutteruser && rm /home/flutteruser/sdk-tools.zip
RUN mv /home/flutteruser/tools /home/flutteruser/Android/sdk/tools
RUN cd /home/flutteruser/Android/sdk/tools/bin && yes | ./sdkmanager --licenses && ./sdkmanager "build-tools;30.0.2" "platform-tools" "cmdline-tools;latest" "ndk;24.0.8215888"
ENV PATH "$PATH:/home/flutteruser/Android/sdk/platform-tools"

# Set ownership of the SDK to the non-root user
RUN chown -R flutteruser:flutteruser /home/flutteruser/Android
RUN update-java-alternatives --set /usr/lib/jvm/java-1.11.0-openjdk-amd64

# Create the pub-cache directory and set permissions
RUN mkdir -p /pub-cache && chown -R flutteruser:flutteruser /pub-cache

# Switch to non-root user
USER flutteruser

# Install Flutter SDK as non-root user
RUN git clone https://github.com/flutter/flutter.git
ENV PATH "$PATH:/home/flutteruser/flutter/bin"
RUN flutter channel stable && cd flutter && git checkout 3.16.3 && flutter config --enable-linux-desktop

# Install Rust
RUN curl https://sh.rustup.rs -sSf | \
    sh -s -- --default-toolchain stable -y

ENV PATH=/home/flutteruser/.cargo/bin:$PATH

# Keep Dart cache directory outside of home
ENV PUB_CACHE=/pub-cache

# Copy our files
COPY --chown=flutteruser:flutteruser . .

# Build
ENV ANDROID_SDK_ROOT=/home/flutteruser/Android/sdk
ENV CARGO_BUILD_JOBS=4
RUN chmod +x build_ffi_android.sh && ./build_ffi_android.sh
  1. . I ran just docker-build-android. It failed at the last step (executing build_ffi_android.sh), with this error:
STEP 28/28: RUN chmod +x build_ffi_android.sh && ./build_ffi_android.sh
--> Using cache 5f1e8ab5b1c59814f55e60faeaa65661b073ffa9ba315fa46ccaceda4e9bdbc9
COMMIT envoy
--> 5f1e8ab5b1c
Successfully tagged localhost/envoy:latest
5f1e8ab5b1c59814f55e60faeaa65661b073ffa9ba315fa46ccaceda4e9bdbc9
mkdir -p release && docker run --mount type=bind,source="$(pwd)"/release,target=/release -t envoy /bin/bash -c "flutter build apk --release -P nosign && flutter build appbundle --release -P nosign && cp /root/build/app/outputs/flutter-apk/app-release.apk /release && cp /root/build/app/outputs/bundle/release/app-release.aab /release"
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Downloading package sky_engine...                                  622ms
Downloading flutter_patched_sdk tools...                           497ms
Downloading flutter_patched_sdk_product tools...                   675ms
Downloading linux-x64 tools...                                      3.9s
Downloading linux-x64/font-subset tools...                         302ms
Downloading android-arm-profile/linux-x64 tools...                 522ms
Downloading android-arm-release/linux-x64 tools...                 520ms
Downloading android-arm64-profile/linux-x64 tools...               578ms
Downloading android-arm64-release/linux-x64 tools...               524ms
Downloading android-x64-profile/linux-x64 tools...                 539ms
Downloading android-x64-release/linux-x64 tools...                 508ms
Resolving dependencies... (30.0s)
  _fe_analyzer_shared 64.0.0 (70.0.0 available)
  analyzer 6.2.0 (6.5.2 available)
  animations 2.0.10 (2.0.11 available)
  archive 3.4.9 (3.6.1 available)
  args 2.4.2 (2.5.0 available)
  build_daemon 4.0.1 (4.0.2 available)
  build_resolvers 2.4.1 (2.4.2 available)
  build_runner 2.4.7 (2.4.11 available)
  build_runner_core 7.2.11 (7.3.1 available)
  built_value 8.8.1 (8.9.2 available)
  cbor 4.1.0 (6.2.0 available)
  cli_util 0.4.0 (0.4.1 available)
  code_builder 4.8.0 (4.10.0 available)
  coverage 1.6.4 (1.8.0 available)
  cross_file 0.3.3+8 (0.3.4+1 available)
  csslib 0.17.3 (1.0.0 available)
  cupertino_icons 1.0.6 (1.0.8 available)
  custom_lint 0.5.7 (0.6.4 available)
  custom_lint_builder 0.5.7 (0.6.4 available)
  custom_lint_core 0.5.7 (0.6.3 available)
  dart_style 2.3.4 (2.3.6 available)
  dots_indicator 2.1.2 (3.0.0 available)
  ffi 2.1.0 (2.1.2 available)
  file 6.1.4 (7.0.0 available)
  file_picker 5.5.0 (8.0.4 available)
  file_saver 0.1.1 (0.2.13 available)
  flutter_plugin_android_lifecycle 2.0.17 (2.0.20 available)
  flutter_riverpod 2.4.9 (2.5.1 available)
  flutter_secure_storage 5.1.2 (9.2.2 available)
  flutter_secure_storage_linux 1.2.0 (1.2.1 available)
  flutter_secure_storage_macos 1.1.2 (3.1.2 available)
  flutter_secure_storage_platform_interface 1.0.2 (1.1.2 available)
  flutter_secure_storage_web 1.1.2 (1.2.1 available)
  flutter_secure_storage_windows 1.1.3 (3.1.2 available)
  flutter_svg 1.1.6 (2.0.10+1 available)
  freezed 2.4.5 (2.5.3 available)
  frontend_server_client 3.2.0 (4.0.0 available)
  go_router 10.2.0 (14.1.4 available)
  google_fonts 6.1.0 (6.2.1 available)
  hotreloader 4.1.0 (4.2.0 available)
  http 1.1.2 (1.2.1 available)
  intl 0.18.1 (0.19.0 available)
  intl_utils 2.8.6 (2.8.7 available)
  js 0.6.7 (0.7.1 available)
  json_annotation 4.8.1 (4.9.0 available)
  json_serializable 6.7.1 (6.8.0 available)
  local_auth 2.1.7 (2.2.0 available)
  local_auth_android 1.0.36 (1.0.39 available)
  local_auth_ios 1.1.5 (1.1.7 available)
  local_auth_platform_interface 1.0.8 (1.0.10 available)
  matcher 0.12.16 (0.12.16+1 available)
  material_color_utilities 0.5.0 (0.12.0 available)
  meta 1.10.0 (1.15.0 available)
  mime 1.0.4 (1.0.5 available)
  mockito 5.4.3 (5.4.4 available)
  package_info_plus 4.2.0 (8.0.0 available)
  package_info_plus_platform_interface 2.0.1 (3.0.0 available)
  path 1.8.3 (1.9.0 available)
  path_provider 2.1.1 (2.1.3 available)
  path_provider_android 2.2.1 (2.2.5 available)
  path_provider_foundation 2.3.1 (2.4.0 available)
  path_provider_platform_interface 2.1.1 (2.1.2 available)
  permission_handler 9.2.0 (11.3.1 available)
  permission_handler_android 9.0.2+1 (12.0.6 available)
  permission_handler_apple 9.1.4 (9.4.5 available)
  permission_handler_platform_interface 3.12.0 (4.2.1 available)
  permission_handler_windows 0.1.3 (0.2.1 available)
  platform 3.1.2 (3.1.5 available)
  plugin_platform_interface 2.1.7 (2.1.8 available)
  pointycastle 3.7.3 (3.9.1 available)
  process 4.2.4 (5.0.2 available)
  pubspec_parse 1.2.3 (1.3.0 available)
  rive 0.11.17 (0.13.7 available)
  rive_common 0.2.7 (0.4.9 available)
  riverpod 2.4.9 (2.5.1 available)
  riverpod_analyzer_utils 0.5.0 (0.5.3 available)
  riverpod_lint 2.3.7 (2.3.12 available)
  screenshot 2.1.0 (3.0.0 available)
  sembast 3.5.0+1 (3.7.1+2 available)
  share_plus 7.2.1 (9.0.0 available)
  share_plus_platform_interface 3.3.1 (4.0.0 available)
  shared_preferences 2.2.2 (2.2.3 available)
  shared_preferences_android 2.2.1 (2.2.3 available)
  shared_preferences_foundation 2.3.4 (2.4.0 available)
  shared_preferences_platform_interface 2.3.1 (2.3.2 available)
  shared_preferences_web 2.2.2 (2.3.0 available)
  shelf_web_socket 1.0.4 (2.0.0 available)
  source_gen 1.4.0 (1.5.0 available)
  synchronized 3.1.0 (3.1.0+1 available)
  test 1.24.9 (1.25.7 available)
  test_api 0.6.1 (0.7.2 available)
  test_core 0.5.9 (0.6.4 available)
  timeago 3.6.0 (3.6.1 available)
  url_launcher 6.2.2 (6.3.0 available)
  url_launcher_android 6.2.0 (6.3.3 available)
  url_launcher_ios 6.2.1 (6.3.0 available)
  url_launcher_macos 3.1.0 (3.2.0 available)
  url_launcher_platform_interface 2.2.0 (2.3.2 available)
  url_launcher_web 2.2.2 (2.3.1 available)
  url_launcher_windows 3.1.0 (3.1.1 available)
  uuid 3.0.7 (4.4.0 available)
  vm_service 11.10.0 (14.2.3 available)
  wakelock_plus 1.1.4 (1.2.5 available)
  wakelock_plus_platform_interface 1.1.0 (1.2.1 available)
! watcher 1.1.0 (overridden)
  web 0.3.0 (0.5.1 available)
  web_socket_channel 2.4.0 (3.0.0 available)
  webdriver 3.0.2 (3.0.3 available)
  win32 5.1.1 (5.5.1 available)
  xdg_directories 1.0.3 (1.0.4 available)
Got dependencies!
109 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

Warning: Failed to download any source lists!
Warning: IO exception while downloading manifest:
java.nio.file.NoSuchFileException: /home/flutteruser/.android/cache/sdkbin-1_b7518f9e-repository2-3_xml
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
    at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
    at java.base/java.nio.file.Files.newOutputStream(Files.java:220)
    at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:150)
    at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:132)
    at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.downloadAndCache(DownloadCache.java:651)
    at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.openCachedUrl(DownloadCache.java:545)
    at com.android.sdklib.repository.legacy.LegacyDownloader.downloadAndStream(LegacyDownloader.java:82)
    at com.android.repository.impl.downloader.LocalFileAwareDownloader.downloadAndStream(LocalFileAwareDownloader.java:51)
    at com.android.repository.impl.manager.RemoteRepoLoaderImpl.lambda$fetchPackages$0(RemoteRepoLoaderImpl.java:138)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Warning: IO exception while downloading manifest:
java.nio.file.NoSuchFileException: /home/flutteruser/.android/cache/sdkbin-1_b743781d-repository2-2_xml
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
    at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
    at java.base/java.nio.file.Files.newOutputStream(Files.java:220)
    at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:150)
    at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:132)
    at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.downloadAndCache(DownloadCache.java:651)
    at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.openCachedUrl(DownloadCache.java:545)
    at com.android.sdklib.repository.legacy.LegacyDownloader.downloadAndStream(LegacyDownloader.java:82)
    at com.android.repository.impl.downloader.LocalFileAwareDownloader.downloadAndStream(LocalFileAwareDownloader.java:51)
    at com.android.repository.impl.manager.RemoteRepoLoaderImpl.lambda$fetchPackages$0(RemoteRepoLoaderImpl.java:138)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Warning: Still waiting for package manifests to be fetched remotely.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':rive_common'.
> NDK not configured. Download it with SDK manager. Preferred NDK version is '23.1.7779620'. 

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 24s
Running Gradle task 'assembleRelease'...                          205.0s
Gradle task assembleRelease failed with exit code 1
error: Recipe `docker-build-android` failed on line 17 with exit code 1

Please provide the steps that you've used to reproduce the issue

No response

If applicable, add screenshots or screen recordings to help explain the issue.

No response

If applicable, add logs to help us diagnose the issue.

No response

Anything else?

No response

Impact of the issue

None

If you found any similar or related issues, provide links to them here.

-

icota commented 2 weeks ago

Thank you for the report @basantagoswami. Manual build is going to be fragile (and definitely not reproducible) due to lack of Flutter version pining. That's why we always use docker.

I'm really surprised running just docker-build-android does not work for you. I just checked out v1.6.2 and running that command completes fine. I do not see the Woah! You appear to be trying to run flutter as root. which makes me think something is different in our docker setup.

Emulate Docker CLI using podman indicates you're not running vanilla docker? But I'm not familiar with podman at all. What's the output of docker -v for you? FWIW on Ubuntu 24.04 mine is:

Docker version 24.0.7, build 24.0.7-0ubuntu4
basantagoswami commented 2 weeks ago

I am using Podman instead of Docker CE. I think the package name is podman-docker on Ubuntu.

$ docker -v
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman version 3.4.4

I will try using Docker Community Edition once and see if that works. Could be an issue with Podman itself.

icota commented 2 weeks ago

Could be an issue with Podman itself.

That seems to be the case. I just tried building with whatever podman comes with Ubuntu and get the exact same errors you did:

/usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: Exiting with failure status due to previous errors
Downloading Gradle Wrapper...                                       35ms
/usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/usr/bin/tar: Exiting with failure status due to previous errors
Flutter could not download and/or extract https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz. Ensure you have network connectivity and all of the required dependencies listed at flutter.dev/setup.
The original exception was: ProcessException: The command failed with exit code 2
  Command: tar -xzf /root/flutter/bin/cache/downloads/storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz -C /root/flutter/bin/cache/artifacts/gradle_wrapper.
Error: building at STEP "RUN flutter channel stable && cd flutter && git checkout 3.16.3 && flutter config --enable-linux-desktop": while running runtime: exit status 1