#android #docker #build #aapt2
Вопрос:
Я пытаюсь создать приложение для Android, созданное с помощью ионного углового внутри созданного изображения docker, и я получаю следующую ошибку, однако изображение построено правильно, когда я пытаюсь выполнить команду
./gradlew bundle
я получаю следующую ошибку
BUILD FAILED in 6s
38 actionable tasks: 1 executed, 37 up-to-date
root@docker-desktop:/app/android# ./gradlew bundle --no-daemon
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
> Configure project :app
google-services.json not found, google-services plugin not applied. Push Notifications won't work
WARNING:: Using flatDirs should be avoided because it doesn't support any meta-data formats.
Currently detected usages:
- repository flatDir used in: project ':app', project ':capacitor-cordova-android-plugins'
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'android', project ':app', project ':capacitor-android', ...
AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Unexpected error output: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
AAPT2 aapt2-4.2.1-7147631-linux Daemon #1: Unexpected error output: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
> Task :app:bundleDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform appcompat-1.3.0.aar (androidx.appcompat:appcompat:1.3.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/cbe7026f0b6e48e8d36fabe06ed90cb5/appcompat-1.3.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /root/.gradle/caches/transforms-2/files-2.1/916c05b3a76c5123063b127fcd657ead/core-1.5.0.
> AAPT2 aapt2-4.2.1-7147631-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
enter code here
Создание образа Docker
FROM adoptopenjdk/openjdk8
USER root
# Configure base folders.
# set default build arguments
ARG SDK_VERSION=platform-tools_r29.0.4-linux.zip
ARG ANDROID_BUILD_VERSION=29
ARG ANDROID_TOOLS_VERSION=29.0.2
ARG NDK_VERSION=20
ARG NODE_VERSION=14.x
ARG BUCK_VERSION=2019.10.17.01
ARG DEBIAN_FRONTEND=noninteractive
# Update the base image with the required components.
RUN mkdir -p /usr/share/man/man1
amp;amp; apt-get update -qq amp;amp; apt-get install -qq -y --no-install-recommends
apt-transport-https
curl
nano
build-essential
file
wget
tar
zip
net-tools
# lib32stdc 6
# lib32z1
git
gnupg2
python
openssh-client
gradle
unzip
optipng
imagemagick
python
# python2
# python2.7
# python-pip -y
amp;amp; apt-get upgrade -y
amp;amp; apt-get clean
RUN apt-get install openjdk-8-jdk openjdk-8-jre -y
# RUN dpkg --add-architecture i386
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-8-jdk
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash
RUN apt-get install nodejs -y
# set default environment variables
ENV ADB_INSTALL_TIMEOUT=10
ENV ANDROID_SDK_VERSION 3859397
ENV ANDROID_HOME=/opt/android
ENV ANDROID_SDK_HOME=${ANDROID_HOME}
ENV ANDROID_NDK_HOME /opt/android-ndk
# ENV JAVA_HOME=/opt/java/openjdk
ENV PATH=$PATH:$ANDROID_HOME/tools
ENV PATH=$PATH:$ANDROID_HOME/platform-tools
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
ENV PATH=$PATH:$ANDROID_SDK_HOME/tools
ENV PATH=$PATH:$ANDROID_SDK_HOME/platform-tools
ENV PATH ${PATH}:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/tools/bin:${ANDROID_SDK_HOME}/platform-tools
ENV PATH=$PATH:$HOME/.npm-global/bin
ENV ANDROID_NDK_VERSION r20
RUN cd /opt
amp;amp; wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O android-sdk-tools.zip
amp;amp; unzip -q android-sdk-tools.zip -d /opt/android
amp;amp; rm android-sdk-tools.zip
amp;amp; cd /opt
amp;amp; wget -q https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip -O android-commandline-tools.zip
amp;amp; mkdir -p /opt/android/cmdline-tools
amp;amp; unzip -q android-commandline-tools.zip -d /opt/android/cmdline-tools
amp;amp; rm android-commandline-tools.zip
amp;amp; cd /opt
amp;amp; wget -q https://dl.google.com/android/maven2/com/android/tools/build/aapt2/4.2.1-7147631/aapt2-4.2.1-7147631-linux.jar -O aapt2.zip
amp;amp; unzip -q aapt2.zip -d /opt/android/
amp;amp; rm aapt2.zip
ENV PATH ${PATH}:/opt/android/platform-tools:/opt/android/cmdline-tools/tools/bin
RUN yes | sdkmanager --licenses
RUN touch /opt/android/.android/repositories.cfg
RUN sdkmanager "tools" "platform-tools"
RUN yes | sdkmanager --update --channel=3
RUN yes | sdkmanager
"platforms;android-31"
"platforms;android-30"
"platforms;android-29"
"platforms;android-28"
"build-tools;31.0.0"
"build-tools;30.0.3"
"build-tools;29.0.3"
"build-tools;29.0.2"
"build-tools;28.0.3"
"build-tools;28.0.0"
"extras;android;m2repository"
"extras;google;m2repository"
"extras;google;google_play_services"
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1"
"add-ons;addon-google_apis-google-24"
"add-ons;addon-google_apis-google-23"
"add-ons;addon-google_apis-google-22"
"ndk;23.0.7599858"
RUN yes | sdkmanager --update --include_obsolete
RUN apt-get purge maven maven2
amp;amp; apt-get update
amp;amp; apt-get -y install maven
amp;amp; mvn --version
RUN mkdir /opt/android-ndk-tmp amp;amp;
cd /opt/android-ndk-tmp amp;amp;
wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip amp;amp;
# uncompress
unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip amp;amp;
# move to its final location
mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} amp;amp;
# remove temp dir
cd ${ANDROID_NDK_HOME} amp;amp;
rm -rf /opt/android-ndk-tmp
ENV PATH ${PATH}:${ANDROID_NDK_HOME}
RUN npm install -g npm amp;amp; npm install -g app-icon yarn react-native-cli expo-cli create-react-app ionic cordova cordova-res @ionic/cli amp;amp; npm update -g
RUN apt-get clean
EXPOSE 3000 5000 8100 8200 8080 9876 35729 53703 8081 5037 80 19000 19001
VOLUME ["/app"]
WORKDIR /app
CMD ["bash"]
Если вам нужен какой-либо другой файл для проекта, просто спросите, и я обновлю вопрос.