very new to that kind of development I'm just supposed to add little features to the project that is a couple years old, so all developers quit and there is no doc to build the project / recommended version of the libs.
So I went and did a Dockerfile to automate the build of the project seeing the headache that it was to build on Windows (btw the windows build is good but now my manager want me to do a repeatable installation)
My dockerfile is :
# base image
FROM ubuntu:20.04
# install wget tar and apt-add-repository
RUN apt-get update && apt-get -y install wget tar unzip openjdk-8-jdk
# install node js version 10.19.0 for linux, should be downloaded in local?
RUN wget https://nodejs.org/dist/v10.19.0/node-v10.19.0-linux-x64.tar.gz
RUN tar -C /usr/local --strip-components 1 -xzf node-v10.19.0-linux-x64.tar.gz
#install gradle 4.10.3
RUN wget https://services.gradle.org/distributions/gradle-4.10.3-bin.zip -P /tmp
RUN unzip -d /opt/gradle /tmp/gradle-4.10.3-bin.zip
# install android command line
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
# create a directory else it doesn't work see https://stackoverflow.com/a/56175645/14137672
RUN mkdir -p /sdk && mv commandlinetools-linux-7583922_latest.zip /sdk && cd /sdk && unzip commandlinetools-linux-7583922_latest.zip
WORKDIR "/sdk/cmdline-tools"
# specific to commandlinetools-linux-7583922 the unzipped folder is not correct, it needs to be under latest folder, so /cmdline-tools/latest/...
# see https://stackoverflow.com/a/67413427/14137672 for more informations about this
RUN mkdir .latest && mv * .latest && mv .latest latest
ENV PATH="/sdk/cmdline-tools/latest/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin/:/sdk/cmdline-tools/latest:/opt/gradle/gradle-4.10.3/bin:${PATH}"
ENV ANDROID_SDK_ROOT=/sdk/cmdline-tools/latest/bin
ENV GRADLE_HOME=/opt/gradle/gradle-4.10.3
WORKDIR "/sdk/cmdline-tools/latest/bin"
RUN chmod +770 /sdk/cmdline-tools/latest/bin/sdkmanager
RUN /sdk/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-19" "platforms;android-20" "platforms;android-21" "platforms;android-22" "platforms;android-23" "platforms;android-24" "platforms;android-25" "system-images;android-28;default;x86"
RUN /sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-26" "platforms;android-27" "platforms;android-28" "platforms;android-29" "platforms;android-30" "platforms;android-31" "platforms;android-Sv2" "skiaparser;1" "system-images;android-29;google_apis;x86"
RUN /sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;31.0.0" "build-tools;30.0.2" "build-tools;29.0.3" "build-tools;29.0.2" "build-tools;29.0.1" "build-tools;29.0.0" "build-tools;28.0.3" "build-tools;20.0.0" "build-tools;19.1.0" "system-images;android-31;default;x86_64"
RUN /sdk/cmdline-tools/latest/bin/sdkmanager "cmdline-tools;5.0" "cmdline-tools;4.0" "ndk;23.1.7779620" "emulator" "extras;google;market_apk_expansion" "extras;google;instantapps" "extras;google;market_licensing" "extras;google;google_play_services"
RUN /sdk/cmdline-tools/latest/bin/sdkmanager "system-images;android-19;default;x86" "system-images;android-21;default;x86" "system-images;android-22;default;x86" "system-images;android-23;default;x86" "system-images;android-24;default;x86" "system-images;android-25;default;x86" "system-images;android-26;default;x86" "system-images;android-27;default;x86"
COPY . /usr/local/myapp
WORKDIR "/usr/local/myapp"
# should not be commited
RUN rm -rf node_modules/
# install project dependancies
RUN npm install
RUN npm install -g ionic@5.4.16
RUN npm install -g cordova@10.0.0
RUN cordova telemetry off
# no native because we don't have android fully installed
#RUN ionic cordova run android --no-native-run --no-telemetry
So the idea is that I'm not installing the whole Android Studio I just need the platforms;android-X and that's the simplest way I found to install them.
Now I'm facing the error :
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
But from my understanding I already have installed it using sdkmanager ...
On my Windows I had the whole installation so I had :
ANDROID_HOME = C:\Users\me\AppData\Local\Android\Sdk\build-tools
ANDROID_SDK_ROOT = C:\Program Files (x86)\Android\android-sdk
And in my Windows path :
C:\Program Files (x86)\Android\android-sdk\platform-tools
C:\Users\me\AppData\Local\Android\Sdk\tools
C:\Users\me\AppData\Local\Android\Sdk\tools\bin
So finally my question is how do I set the path and env variables in my docker as I don't have the full installation of Android Studio ?
If you have Docker changes / advices I will happily take them I'm far from a Docker expert.
Edit :
Just found out that disabling native-run was a false problem and i just needed to install the library with npm
RUN npm install -g native-run@1.5.0