Skip to content

Commit

Permalink
fixed incompatibilities by linking
Browse files Browse the repository at this point in the history
to new fork of cordova-hot-code-push, removing obsolete WhitelistPlugin, and updating plugins.
Updated Gradle to 7.6, Cordova to 11, and build-tools to 33. API level = 32.
  • Loading branch information
chrisekelley committed Nov 29, 2022
1 parent 99f7a0b commit bbc31a0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 40 deletions.
74 changes: 35 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,104 +30,100 @@ RUN apt-get update && apt-get -y install \
# Set up environment variables
ENV ANDROID_HOME /opt/android-sdk
# https://developer.android.com/studio#command-tools
ENV CMDLINE_TOOLS_URL https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
ENV GRADLE_URL https://services.gradle.org/distributions/gradle-6.5-all.zip
ENV API_LEVEL=30 \
ANDROID_BUILD_TOOLS_VERSION=30.0.2
ENV CMDLINE_TOOLS_URL https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
ENV GRADLE_URL https://services.gradle.org/distributions/gradle-7.6-all.zip
ENV API_LEVEL=32 \
ANDROID_BUILD_TOOLS_VERSION=33.0.1

RUN echo "ANDROID_HOME: $ANDROID_HOME"
RUN echo "ANDROID_BUILD_TOOLS_VERSION: $ANDROID_BUILD_TOOLS_VERSION"

WORKDIR /opt

ENV ANDROID_SDK_ROOT=$ANDROID_HOME \
PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/tools:${ANDROID_HOME}/cmdline-tools/tools/bin:${ANDROID_HOME}/platform-tools
PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools

# Download Android SDK
RUN mkdir "$ANDROID_HOME" .android \
&& cd "$ANDROID_HOME" \
&& mkdir cmdline-tools \
&& curl -o cmdline-tools/commandlinetools.zip $CMDLINE_TOOLS_URL \
&& unzip cmdline-tools/commandlinetools.zip -d cmdline-tools \
&& rm cmdline-tools/commandlinetools.zip
# && mkdir cmdline-tools \
&& curl -o commandlinetools.zip $CMDLINE_TOOLS_URL \
&& unzip commandlinetools.zip \
&& rm commandlinetools.zip \
&& cp -R cmdline-tools latest \
&& mv latest cmdline-tools/latest

# Accept all licenses
RUN yes | sdkmanager --licenses

RUN touch /root/.android/repositories.cfg

RUN echo 8933bad161af4178b1185d1a37fbf41ea5269c55 > $ANDROID_HOME/licenses/android-sdk-license
RUN echo d56f5187479451eabf01fb78af6dfcb131a6481e >> $ANDROID_HOME/licenses/android-sdk-license
RUN echo 84831b9409646a918e30573bab4c9c91346d8abd > $ANDROID_HOME/licenses/android-sdk-preview-license
#RUN echo y | sdkmanager --channel=3 emulator

RUN echo y | sdkmanager "tools" "platform-tools"
RUN echo "uname: $(uname -m)"

# Emulator and Platform tools
RUN yes | sdkmanager "emulator" "platform-tools"

RUN echo y | sdkmanager "tools"
RUN echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION"
## Android 5
RUN echo y | sdkmanager "platforms;android-22" "platforms;android-21"
RUN echo y | sdkmanager "platforms;android-21" "platforms;android-22"
## Android 6 and 7
RUN echo y | sdkmanager "platforms;android-25" "platforms;android-24" "platforms;android-23"
RUN echo y | sdkmanager "platforms;android-23" "platforms;android-24" "platforms;android-25"
## Android 8
RUN echo y | sdkmanager "platforms;android-27" "platforms;android-26"
RUN echo y | sdkmanager "platforms;android-26" "platforms;android-27" "platforms;android-28"
## Android 10 and 9
RUN echo y | sdkmanager "platforms;android-29" "platforms;android-28"
## Android 11
RUN echo y | sdkmanager "platforms;android-29" "platforms;android-30" "platforms;android-31"

RUN echo y | sdkmanager "platforms;android-${API_LEVEL}"

## Mavien libs for Gradle
RUN echo y | sdkmanager "extras;android;m2repository" "extras;google;m2repository"

# Workaround for a dependency that demands build-tools 32.
RUN echo y | sdkmanager "build-tools;32.0.0"

# Install Cordova and other useful globals
RUN npm update && \
npm install -g cordova@10.0.0
npm install -g cordova@11.0.0

# Install Gradle
RUN wget -q $GRADLE_URL -O gradle.zip \
&& unzip -qq gradle.zip \
&& mv gradle-6.5 gradle \
&& mv gradle-7.6 gradle \
# && rm gradle.zip \
&& mkdir /root/.gradle

# Support Gradle
ENV GRADLE_HOME /opt/gradle
ENV PATH="${PATH}:${GRADLE_HOME}/bin"
ENV JAVA_OPTS "-Xms512m -Xmx1536m"
RUN echo "PATH: $PATH"
RUN echo `which gradle`
ENV CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=file:///opt/gradle.zip

RUN echo "pwd : $PWD"
RUN git clone -b 9.0.0 https://github.com/apache/cordova-android.git
RUN git clone -b 11.0.0 https://github.com/apache/cordova-android.git
ENV CORDOVA_ANDROID_DIRECTORY="/opt/cordova-android"

RUN mkdir -p /tangerine/client/builds/apk

ADD cordova /tangerine/client/builds/apk/
WORKDIR /tangerine/client/builds/apk

RUN pwd && ls

RUN cordova platform add [email protected] && sleep 10
##RUN cordova platform add $CORDOVA_ANDROID_DIRECTORY --nosave && sleep 30
RUN cordova platform add [email protected] && sleep 5

RUN cordova plugin add cordova-plugin-whitelist --save && sleep 5
# TODO: awaiting fix for -dev versions of cordova-android: https://github.com/apache/cordova-lib/issues/790
# So, remove the specific @ versions when this issue has been resolved.
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add cordova-plugin-androidx --save && sleep 5
RUN cordova plugin add cordova-plugin-androidx-adapter --save && sleep 5
RUN cordova plugin add cordova-hot-code-push-plugin --save && sleep 5
RUN cordova plugin add github:Tangerine-Community/cordova-hot-code-push --save && sleep 5
RUN cordova plugin add [email protected] --save && sleep 5
RUN cordova plugin add cordova-sms-plugin --save && sleep 5
RUN cordova plugin add cordova-plugin-android-permissions --save && sleep 5
RUN cordova plugin add github:brodybits/cordova-plugin-sqlcipher-crypto-batch-connection-manager-core-pro-free#unstable-build-2020-07-15-01 --save && sleep 5
RUN cordova plugin add cordova-sqlite-storage-file --save && sleep 5

#RUN export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))"
RUN echo "JAVA_HOME : $(dirname $(dirname $(readlink -f $(which java))))"
#ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
ENV JAVA_HOME $(dirname $(dirname $(readlink -f $(which java))))
RUN echo "export JAVA_HOME=$(dirname $(dirname $(readlink -f $(type -P java))))" > /etc/profile.d/javahome.sh

RUN cordova build

Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ If you have plugins that modify the application property, you may wish to change
docker build -t tangerine/docker-tangerine-base-image:TAGNAME .
```

If you're trying to build on an M1-based Mac, use the following command:

```
docker build --platform linux/amd64 -t tangerine/docker-tangerine-base-image:TAGNAME .
```

## Running

```
docker run --name=base -td tangerine/docker-tangerine-base-image:TAGNAME
docker exec -it base bash
```

If you're trying to run on an M1-based Mac, use the following command:

```
docker run --platform linux/amd64 --name=base -td tangerine/docker-tangerine-base-image:TAGNAME
docker exec -it base bash
```


## Deployment

Please follow the [Release Instructions](RELEASE-INSTRUCTIONS.md) for deployments.
Expand Down
2 changes: 1 addition & 1 deletion cordova/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<auto-download enabled="false" />
<auto-install enabled="false" />
</chcp>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="32" />
<config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
1 change: 1 addition & 0 deletions cordova/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="background">#FFCD96</color>
<color name="cdv_splashscreen_background">#FFCD96</color>
</resources>

0 comments on commit bbc31a0

Please sign in to comment.