-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the App #5
Comments
what files are missing ? You have the source downloaded ? |
I downloaded the source. |
what error are you getting ? i compiled a version last month without any issues. |
Hi @Lucanio4 , Thank you for the detailed bug report. 🙃 @originalheff, I tried to build the app (master branch,
To test it into a container (on a Linux host), I created a
The two main Bash scripts The Dockerfile starts from a Ubuntu image and runs some commands to install system dependencies (+ some tools) then the Android SDK . It also adds the This is clearly dirty made, just to have an idea of what's happening in a controlled environment. The files: 110-docker_image_build.sh
210-run.sh
variables.sh
Dockerfile
entrypoint.sh
To run it, just go into the
Please note that it will use a lot of disk space (5-6 GB), and will take quite some time depending on your host resources and internet connection bandwidth. |
Howdy
I tried again earlier this week.
Downloaded android studio and all kinds of add-ons etc.
Tried to rebuild with still so many errors.
I was writing a response earlier this week and the power went off. Then
just studies and work took priority.
These places seems to be a dark hole of code which even veterans like
myself cannot figure out. But new to Android.
I think if they actually give the exact programs to install and versions it
will go a long way.
If I can get a step by step guide on how to communicate with the TD5 ECU I
can write something myself.
That is why I am going to these places to reverse engineer programs to try
understanding the communication. Then when it doesn't compile I set it
aside.
Best of luck.
Lucanio
…On Fri, 29 Oct 2021, 18:58 Aloike, ***@***.***> wrote:
Hi @Lucanio4 <https://github.com/Lucanio4> , Thank you for the detailed
bug report. 🙃
@originalheff <https://github.com/originalheff>, I tried to build the app
(master branch, heads/master-0-gcc79c5e) into a container from scratch,
and I had some errors related to Lint. I struggled to make Lint work (dunno
why, it wasn't able to find the Android API). Anyway, my quick and dirty
solution was to disable the "abort on error" option. Here is the patch:
diff --git a/app/build.gradle b/app/build.gradle
index d843ae4..7d4890f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ lintOptions {
+ abortOnError false
+ }
productFlavors {
}
}
------------------------------
To test it into a container (on a Linux host), I created a docker
directory at the root of the git repository that looks like this:
[root of the Git clone]
├── app/
├── build/
├── docker/
│ ├── 110-docker_image_build.sh
│ ├── 210-run.sh
│ ├── Dockerfile
│ ├── rsrc/
│ │ └── entrypoint.sh
│ └── variables.sh
├── docs/
├── gradle/
└── (other project files)
The two main Bash scripts 110-docker_image_build.sh and 210-run.sh
respectively create the docker image from the Dockerfile configuration
and run a container from the generated image. A complementary file
variables.sh defines a few variables common to both scripts.
The Dockerfile starts from a Ubuntu image and runs some commands to
install system dependencies (+ some tools) then the Android SDK . It also
adds the entrypoint.sh script. This one will just call the gradlew build
command in the project's directory with some options.
This is clearly dirty made, just to have an idea of what's happening in a
controlled environment.
The files:
110-docker_image_build.sh
#!/bin/bash
set -e
source variables.sh
# Build the image
docker build \
--build-arg GRADLE_VERSION=${DOCKER_ANDROIDENV_GRADLE_VERSION} \
--build-arg ANDROID_API_LEVEL=${DOCKER_ANDROIDENV_ANDROID_API_LEVEL} \
--build-arg ANDROID_BUILD_TOOLS_LEVEL=${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL} \
--tag ${DOCKER_ANDROIDENV_IMAGENAME} \
.
exit $?
210-run.sh
#!/bin/bash
# set -e
source variables.sh
PROJECT_DIR_TOPLEVEL=../
# Enter the top level of your project directory
# pushd ${PROJECT_DIR_TOPLEVEL}
PROJECT_DIR_TMP=`mktemp --directory /tmp/docker-android-build_XXX`
echo "########################################"
echo "# PROJECT_DIR_TMP='${PROJECT_DIR_TMP}'"
echo "########################################"
cp -r "${PROJECT_DIR_TOPLEVEL}" "${PROJECT_DIR_TMP}"
DIR_CACHE=/tmp/${DOCKER_IMAGE_NAME}/cache
mkdir -p "${DIR_CACHE}"
DIR_CACHE_ANDROID=${DIR_CACHE}/android
DIR_CACHE_GRADLE=${DIR_CACHE}/gradle
# Run the container
docker run \
--privileged \
-it \
--rm \
--env GRADLEW_OPTIONS="${DOCKER_ANDROIDENV_GRADLE_OPTIONS[@]}" \
-v ${PROJECT_DIR_TMP}:/workspace/project \
${DOCKER_ANDROIDENV_IMAGENAME} #\
# -v ${DIR_CACHE_ANDROID}:/root/.android \
# -v ${DIR_CACHE_GRADLE}:/root/.gradle/ \
# -v $PWD:/workspace/project \
# bash -c ". /workspace/emulator_start.sh && gradlew build -p /workspace/project"
exit_code=$?
# If no error occured, remove the temporary directory (otherwise keep it for debug)
if [[ "${exit_code}" -eq "0" ]]
then
echo "Deleting '${PROJECT_DIR_TMP}'..."
rm -rf "${PROJECT_DIR_TMP}"
fi
exit ${exit_code}
variables.sh
#!/bin/sh
DOCKER_IMAGE_NAME_PREFIX=android-env
DOCKER_ANDROIDENV_GRADLE_VERSION=3.3
DOCKER_ANDROIDENV_GRADLE_OPTIONS+=('--info')
# DOCKER_ANDROIDENV_ANDROID_API_LEVEL=28
DOCKER_ANDROIDENV_ANDROID_API_LEVEL=25
# DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=28.0.3
DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=26.0.2
DOCKER_ANDROIDENV_IMAGENAME=${DOCKER_IMAGE_NAME_PREFIX}_gradle-${DOCKER_ANDROIDENV_GRADLE_VERSION}_android-${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL}
Dockerfile
## @see https://betterprogramming.pub/build-a-lightweight-docker-container-for-android-testing-2aa6bdaea422
FROM ubuntu:latest
SHELL ["/bin/bash", "-c"]
# ##############################################################################
# Install system packages
# ##############################################################################
# https://serverfault.com/a/1016972 : To make the `tzdata` package install.
ARG DEBIAN_FRONTEND="noninteractive"
# ENV TZ="Europe/London"
# APT dependencies
RUN apt update \
&& apt install -y \
git \
libasound2 \
libc6 \
libglu1 \
libnss3 \
libpulse-dev \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxtst6 \
openjdk-8-jdk \
unzip \
vim \
wget
# ##############################################################################
# Install SDK packages
# ##############################################################################
# Gradle
ARG GRADLE_VERSION=6.9.1
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp \
&& unzip -d /opt/gradle /tmp/gradle-${GRADLE_VERSION}-bin.zip \
&& mkdir /opt/gradlew \
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper --gradle-version ${GRADLE_VERSION} --distribution-type all -p /opt/gradlew \
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper -p /opt/gradlew
ENV GRADLE_HOME=/opt/gradle/gradle-$GRADLE_VERSION
# Android SDK
ARG ANDROID_API_LEVEL=28
ARG ANDROID_BUILD_TOOLS_LEVEL=28.0.3
RUN wget 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip' -P /tmp \
&& unzip -d /opt/android /tmp/sdk-tools-linux-4333796.zip \
&& yes Y | /opt/android/tools/bin/sdkmanager --install "platform-tools" "system-images;android-${ANDROID_API_LEVEL};google_apis;x86" "platforms;android-${ANDROID_API_LEVEL}" "build-tools;${ANDROID_BUILD_TOOLS_LEVEL}" "emulator" \
&& yes Y | /opt/android/tools/bin/sdkmanager --licenses \
&& echo "no" | /opt/android/tools/bin/avdmanager --verbose create avd --force --name "test" --device "pixel" --package "system-images;android-${ANDROID_API_LEVEL};google_apis;x86" --tag "google_apis" --abi "x86"
ENV ANDROID_HOME=/opt/android/
ENV PATH "$PATH:$GRADLE_HOME/bin:/opt/gradlew:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
ENV LD_LIBRARY_PATH "$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib"
# ##############################################################################
# Set the entry point
# ##############################################################################
ENV DIR_WORKSPACE=/workspace
ENV DIR_PROJECT=${DIR_WORKSPACE}/project
# Set the working directory
RUN mkdir -p ${DIR_WORKSPACE}
WORKDIR ${DIR_WORKSPACE}
# Add entry point
COPY rsrc/entrypoint.sh ${DIR_WORKSPACE}
RUN chmod +x ${DIR_WORKSPACE}/entrypoint.sh
ENTRYPOINT [ "/workspace/entrypoint.sh" ]
entrypoint.sh
#!/bin/bash
set -e
# ------------------------------------------------------------------------------
# Build the project
# ------------------------------------------------------------------------------
echo "########################################"
echo "# Build the project"
echo "########################################"
gradlew build \
-p ${DIR_PROJECT} \
--stacktrace \
${GRADLEW_OPTIONS}
# --warning-mode all #< to show the individual deprecation warnings.
# --scan \ #< to get full insights.
exit $?
To run it, just go into the docker directory and call the scripts.
cd docker/
# Build the image.
# It will download and install system dependencies and Android SDK on a Ubuntu base image.
bash 110-docker_image_build.sh
# Build the project.
# It will:
# + copy the sources into a temporary directory,
# + mount the temporary project dir into the container
# + Attempt to build the project using `gradlew`
bash 210-run.sh
# A message should telle whether the build was successful or not.
# On success, the temporary directory will be deleted (otherwise will be kept for debug).
Please note that it will use a lot of disk space (*5-6 GB*), and will
take quite some time depending on your host resources and internet
connection bandwidth.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS5SYP4JZWOTQINHMKGHBLTUJLOC5ANCNFSM4WMZMSFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I am building the project on window 10 64bit , using Android studio.
Builds straight away for me , I can connect a Android tablet and remote debug etc. I am building the master branch , I assume the issue is with the docker container
john
From: Aloike ***@***.***>
Sent: 29 October 2021 17:58
To: hairyone/TD5Tester ***@***.***>
Cc: originalheff ***@***.***>; Mention ***@***.***>
Subject: Re: [hairyone/TD5Tester] Get the App (#5)
Hi @Lucanio4<https://github.com/Lucanio4> , Thank you for the detailed bug report. 🙃
@originalheff<https://github.com/originalheff>, I tried to build the app (master branch, heads/master-0-gcc79c5e) into a container from scratch, and I had some errors related to Lint. I struggled to make Lint work (dunno why, it wasn't able to find the Android API). Anyway, my quick and dirty solution was to disable the "abort on error" option. Here is the patch:
diff --git a/app/build.gradle b/app/build.gradle
index d843ae4..7d4890f 100644
…--- a/app/build.gradle
+++ b/app/build.gradle
@@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ lintOptions {
+ abortOnError false
+ }
productFlavors {
}
}
________________________________
To test it into a container (on a Linux host), I created a docker directory at the root of the git repository that looks like this:
[root of the Git clone]
├── app/
├── build/
├── docker/
│ ├── 110-docker_image_build.sh
│ ├── 210-run.sh
│ ├── Dockerfile
│ ├── rsrc/
│ │ └── entrypoint.sh
│ └── variables.sh
├── docs/
├── gradle/
└── (other project files)
The two main Bash scripts 110-docker_image_build.sh and 210-run.sh respectively create the docker image from the Dockerfile configuration and run a container from the generated image. A complementary file variables.sh defines a few variables common to both scripts.
The Dockerfile starts from a Ubuntu image and runs some commands to install system dependencies (+ some tools) then the Android SDK . It also adds the entrypoint.sh script. This one will just call the gradlew build command in the project's directory with some options.
This is clearly dirty made, just to have an idea of what's happening in a controlled environment.
The files:
110-docker_image_build.sh
#!/bin/bash
set -e
source variables.sh
# Build the image
docker build \
--build-arg GRADLE_VERSION=${DOCKER_ANDROIDENV_GRADLE_VERSION} \
--build-arg ANDROID_API_LEVEL=${DOCKER_ANDROIDENV_ANDROID_API_LEVEL} \
--build-arg ANDROID_BUILD_TOOLS_LEVEL=${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL} \
--tag ${DOCKER_ANDROIDENV_IMAGENAME} \
.
exit $?
210-run.sh
#!/bin/bash
# set -e
source variables.sh
PROJECT_DIR_TOPLEVEL=../
# Enter the top level of your project directory
# pushd ${PROJECT_DIR_TOPLEVEL}
PROJECT_DIR_TMP=`mktemp --directory /tmp/docker-android-build_XXX`
echo "########################################"
echo "# PROJECT_DIR_TMP='${PROJECT_DIR_TMP}'"
echo "########################################"
cp -r "${PROJECT_DIR_TOPLEVEL}" "${PROJECT_DIR_TMP}"
DIR_CACHE=/tmp/${DOCKER_IMAGE_NAME}/cache
mkdir -p "${DIR_CACHE}"
DIR_CACHE_ANDROID=${DIR_CACHE}/android
DIR_CACHE_GRADLE=${DIR_CACHE}/gradle
# Run the container
docker run \
--privileged \
-it \
--rm \
--env GRADLEW_OPTIONS="${DOCKER_ANDROIDENV_GRADLE_OPTIONS[@]}" \
-v ${PROJECT_DIR_TMP}:/workspace/project \
${DOCKER_ANDROIDENV_IMAGENAME} #\
# -v ${DIR_CACHE_ANDROID}:/root/.android \
# -v ${DIR_CACHE_GRADLE}:/root/.gradle/ \
# -v $PWD:/workspace/project \
# bash -c ". /workspace/emulator_start.sh && gradlew build -p /workspace/project"
exit_code=$?
# If no error occured, remove the temporary directory (otherwise keep it for debug)
if [[ "${exit_code}" -eq "0" ]]
then
echo "Deleting '${PROJECT_DIR_TMP}'..."
rm -rf "${PROJECT_DIR_TMP}"
fi
exit ${exit_code}
variables.sh
#!/bin/sh
DOCKER_IMAGE_NAME_PREFIX=android-env
DOCKER_ANDROIDENV_GRADLE_VERSION=3.3
DOCKER_ANDROIDENV_GRADLE_OPTIONS+=('--info')
# DOCKER_ANDROIDENV_ANDROID_API_LEVEL=28
DOCKER_ANDROIDENV_ANDROID_API_LEVEL=25
# DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=28.0.3
DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=26.0.2
DOCKER_ANDROIDENV_IMAGENAME=${DOCKER_IMAGE_NAME_PREFIX}_gradle-${DOCKER_ANDROIDENV_GRADLE_VERSION}_android-${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL}
Dockerfile
## @see https://betterprogramming.pub/build-a-lightweight-docker-container-for-android-testing-2aa6bdaea422
FROM ubuntu:latest
SHELL ["/bin/bash", "-c"]
# ##############################################################################
# Install system packages
# ##############################################################################
# https://serverfault.com/a/1016972 : To make the `tzdata` package install.
ARG DEBIAN_FRONTEND="noninteractive"
# ENV TZ="Europe/London"
# APT dependencies
RUN apt update \
&& apt install -y \
git \
libasound2 \
libc6 \
libglu1 \
libnss3 \
libpulse-dev \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxtst6 \
openjdk-8-jdk \
unzip \
vim \
wget
# ##############################################################################
# Install SDK packages
# ##############################################################################
# Gradle
ARG GRADLE_VERSION=6.9.1
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip<https://services.gradle.org/distributions/gradle-$%7bGRADLE_VERSION%7d-bin.zip> -P /tmp \
&& unzip -d /opt/gradle /tmp/gradle-${GRADLE_VERSION}-bin.zip \
&& mkdir /opt/gradlew \
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper --gradle-version ${GRADLE_VERSION} --distribution-type all -p /opt/gradlew \
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper -p /opt/gradlew
ENV GRADLE_HOME=/opt/gradle/gradle-$GRADLE_VERSION
# Android SDK
ARG ANDROID_API_LEVEL=28
ARG ANDROID_BUILD_TOOLS_LEVEL=28.0.3
RUN wget 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip' -P /tmp \
&& unzip -d /opt/android /tmp/sdk-tools-linux-4333796.zip \
&& yes Y | /opt/android/tools/bin/sdkmanager --install "platform-tools" "system-images;android-${ANDROID_API_LEVEL};google_apis;x86" "platforms;android-${ANDROID_API_LEVEL}" "build-tools;${ANDROID_BUILD_TOOLS_LEVEL}" "emulator" \
&& yes Y | /opt/android/tools/bin/sdkmanager --licenses \
&& echo "no" | /opt/android/tools/bin/avdmanager --verbose create avd --force --name "test" --device "pixel" --package "system-images;android-${ANDROID_API_LEVEL};google_apis;x86" --tag "google_apis" --abi "x86"
ENV ANDROID_HOME=/opt/android/
ENV PATH "$PATH:$GRADLE_HOME/bin:/opt/gradlew:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
ENV LD_LIBRARY_PATH "$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib"
# ##############################################################################
# Set the entry point
# ##############################################################################
ENV DIR_WORKSPACE=/workspace
ENV DIR_PROJECT=${DIR_WORKSPACE}/project
# Set the working directory
RUN mkdir -p ${DIR_WORKSPACE}
WORKDIR ${DIR_WORKSPACE}
# Add entry point
COPY rsrc/entrypoint.sh ${DIR_WORKSPACE}
RUN chmod +x ${DIR_WORKSPACE}/entrypoint.sh
ENTRYPOINT [ "/workspace/entrypoint.sh" ]
entrypoint.sh
#!/bin/bash
set -e
# ------------------------------------------------------------------------------
# Build the project
# ------------------------------------------------------------------------------
echo "########################################"
echo "# Build the project"
echo "########################################"
gradlew build \
-p ${DIR_PROJECT} \
--stacktrace \
${GRADLEW_OPTIONS}
# --warning-mode all #< to show the individual deprecation warnings.
# --scan \ #< to get full insights.
exit $?
To run it, just go into the docker directory and call the scripts.
cd docker/
# Build the image.
# It will download and install system dependencies and Android SDK on a Ubuntu base image.
bash 110-docker_image_build.sh
# Build the project.
# It will:
# + copy the sources into a temporary directory,
# + mount the temporary project dir into the container
# + Attempt to build the project using `gradlew`
bash 210-run.sh
# A message should telle whether the build was successful or not.
# On success, the temporary directory will be deleted (otherwise will be kept for debug).
Please note that it will use a lot of disk space (5-6 GB), and will take quite some time depending on your host resources and internet connection bandwidth.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AO3XH7GSYLFE5L45A6TXE5LUJLOC5ANCNFSM4WMZMSFA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Good evening
I have a Discovery TD5 2000 model.
Have you tested it on such a year model?
How difficult would it be to change from USB to Bluetooth?
What did you install with Android studio?
Gradle kept giving me errors. Even after installing it all through Android
studio.
Regards
Lucanio
…On Fri, 29 Oct 2021, 19:24 originalheff, ***@***.***> wrote:
I am building the project on window 10 64bit , using Android studio.
Builds straight away for me , I can connect a Android tablet and remote
debug etc. I am building the master branch , I assume the issue is with the
docker container
john
From: Aloike ***@***.***>
Sent: 29 October 2021 17:58
To: hairyone/TD5Tester ***@***.***>
Cc: originalheff ***@***.***>; Mention ***@***.***>
Subject: Re: [hairyone/TD5Tester] Get the App (#5)
Hi @Lucanio4<https://github.com/Lucanio4> , Thank you for the detailed
bug report. 🙃
@originalheff<https://github.com/originalheff>, I tried to build the app
(master branch, heads/master-0-gcc79c5e) into a container from scratch, and
I had some errors related to Lint. I struggled to make Lint work (dunno
why, it wasn't able to find the Android API). Anyway, my quick and dirty
solution was to disable the "abort on error" option. Here is the patch:
diff --git a/app/build.gradle b/app/build.gradle
index d843ae4..7d4890f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -17,6 +17,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), '
proguard-rules.pro'
}
}
+ lintOptions {
+ abortOnError false
+ }
productFlavors {
}
}
________________________________
To test it into a container (on a Linux host), I created a docker
directory at the root of the git repository that looks like this:
[root of the Git clone]
├── app/
├── build/
├── docker/
│ ├── 110-docker_image_build.sh
│ ├── 210-run.sh
│ ├── Dockerfile
│ ├── rsrc/
│ │ └── entrypoint.sh
│ └── variables.sh
├── docs/
├── gradle/
└── (other project files)
The two main Bash scripts 110-docker_image_build.sh and 210-run.sh
respectively create the docker image from the Dockerfile configuration and
run a container from the generated image. A complementary file variables.sh
defines a few variables common to both scripts.
The Dockerfile starts from a Ubuntu image and runs some commands to
install system dependencies (+ some tools) then the Android SDK . It also
adds the entrypoint.sh script. This one will just call the gradlew build
command in the project's directory with some options.
This is clearly dirty made, just to have an idea of what's happening in a
controlled environment.
The files:
110-docker_image_build.sh
#!/bin/bash
set -e
source variables.sh
# Build the image
docker build \
--build-arg GRADLE_VERSION=${DOCKER_ANDROIDENV_GRADLE_VERSION} \
--build-arg ANDROID_API_LEVEL=${DOCKER_ANDROIDENV_ANDROID_API_LEVEL} \
--build-arg
ANDROID_BUILD_TOOLS_LEVEL=${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL} \
--tag ${DOCKER_ANDROIDENV_IMAGENAME} \
.
exit $?
210-run.sh
#!/bin/bash
# set -e
source variables.sh
PROJECT_DIR_TOPLEVEL=../
# Enter the top level of your project directory
# pushd ${PROJECT_DIR_TOPLEVEL}
PROJECT_DIR_TMP=`mktemp --directory /tmp/docker-android-build_XXX`
echo "########################################"
echo "# PROJECT_DIR_TMP='${PROJECT_DIR_TMP}'"
echo "########################################"
cp -r "${PROJECT_DIR_TOPLEVEL}" "${PROJECT_DIR_TMP}"
DIR_CACHE=/tmp/${DOCKER_IMAGE_NAME}/cache
mkdir -p "${DIR_CACHE}"
DIR_CACHE_ANDROID=${DIR_CACHE}/android
DIR_CACHE_GRADLE=${DIR_CACHE}/gradle
# Run the container
docker run \
--privileged \
-it \
--rm \
--env GRADLEW_OPTIONS="${DOCKER_ANDROIDENV_GRADLE_OPTIONS[@]}" \
-v ${PROJECT_DIR_TMP}:/workspace/project \
${DOCKER_ANDROIDENV_IMAGENAME} #\
# -v ${DIR_CACHE_ANDROID}:/root/.android \
# -v ${DIR_CACHE_GRADLE}:/root/.gradle/ \
# -v $PWD:/workspace/project \
# bash -c ". /workspace/emulator_start.sh && gradlew build -p
/workspace/project"
exit_code=$?
# If no error occured, remove the temporary directory (otherwise keep it
for debug)
if [[ "${exit_code}" -eq "0" ]]
then
echo "Deleting '${PROJECT_DIR_TMP}'..."
rm -rf "${PROJECT_DIR_TMP}"
fi
exit ${exit_code}
variables.sh
#!/bin/sh
DOCKER_IMAGE_NAME_PREFIX=android-env
DOCKER_ANDROIDENV_GRADLE_VERSION=3.3
DOCKER_ANDROIDENV_GRADLE_OPTIONS+=('--info')
# DOCKER_ANDROIDENV_ANDROID_API_LEVEL=28
DOCKER_ANDROIDENV_ANDROID_API_LEVEL=25
# DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=28.0.3
DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL=26.0.2
DOCKER_ANDROIDENV_IMAGENAME=${DOCKER_IMAGE_NAME_PREFIX}_gradle-${DOCKER_ANDROIDENV_GRADLE_VERSION}_android-${DOCKER_ANDROIDENV_ANDROID_BUILD_TOOLS_LEVEL}
Dockerfile
## @see
https://betterprogramming.pub/build-a-lightweight-docker-container-for-android-testing-2aa6bdaea422
FROM ubuntu:latest
SHELL ["/bin/bash", "-c"]
#
##############################################################################
# Install system packages
#
##############################################################################
# https://serverfault.com/a/1016972 : To make the `tzdata` package
install.
ARG DEBIAN_FRONTEND="noninteractive"
# ENV TZ="Europe/London"
# APT dependencies
RUN apt update \
&& apt install -y \
git \
libasound2 \
libc6 \
libglu1 \
libnss3 \
libpulse-dev \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxtst6 \
openjdk-8-jdk \
unzip \
vim \
wget
#
##############################################################################
# Install SDK packages
#
##############################################################################
# Gradle
ARG GRADLE_VERSION=6.9.1
RUN wget
https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip
<
https://services.gradle.org/distributions/gradle-$%7bGRADLE_VERSION%7d-bin.zip>
-P /tmp \
&& unzip -d /opt/gradle /tmp/gradle-${GRADLE_VERSION}-bin.zip \
&& mkdir /opt/gradlew \
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper
--gradle-version ${GRADLE_VERSION} --distribution-type all -p /opt/gradlew
\
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper -p /opt/gradlew
ENV GRADLE_HOME=/opt/gradle/gradle-$GRADLE_VERSION
# Android SDK
ARG ANDROID_API_LEVEL=28
ARG ANDROID_BUILD_TOOLS_LEVEL=28.0.3
RUN wget '
https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip' -P
/tmp \
&& unzip -d /opt/android /tmp/sdk-tools-linux-4333796.zip \
&& yes Y | /opt/android/tools/bin/sdkmanager --install "platform-tools"
"system-images;android-${ANDROID_API_LEVEL};google_apis;x86"
"platforms;android-${ANDROID_API_LEVEL}"
"build-tools;${ANDROID_BUILD_TOOLS_LEVEL}" "emulator" \
&& yes Y | /opt/android/tools/bin/sdkmanager --licenses \
&& echo "no" | /opt/android/tools/bin/avdmanager --verbose create avd
--force --name "test" --device "pixel" --package
"system-images;android-${ANDROID_API_LEVEL};google_apis;x86" --tag
"google_apis" --abi "x86"
ENV ANDROID_HOME=/opt/android/
ENV PATH
"$PATH:$GRADLE_HOME/bin:/opt/gradlew:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
ENV LD_LIBRARY_PATH
"$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib"
#
##############################################################################
# Set the entry point
#
##############################################################################
ENV DIR_WORKSPACE=/workspace
ENV DIR_PROJECT=${DIR_WORKSPACE}/project
# Set the working directory
RUN mkdir -p ${DIR_WORKSPACE}
WORKDIR ${DIR_WORKSPACE}
# Add entry point
COPY rsrc/entrypoint.sh ${DIR_WORKSPACE}
RUN chmod +x ${DIR_WORKSPACE}/entrypoint.sh
ENTRYPOINT [ "/workspace/entrypoint.sh" ]
entrypoint.sh
#!/bin/bash
set -e
#
------------------------------------------------------------------------------
# Build the project
#
------------------------------------------------------------------------------
echo "########################################"
echo "# Build the project"
echo "########################################"
gradlew build \
-p ${DIR_PROJECT} \
--stacktrace \
${GRADLEW_OPTIONS}
# --warning-mode all #< to show the individual deprecation warnings.
# --scan \ #< to get full insights.
exit $?
To run it, just go into the docker directory and call the scripts.
cd docker/
# Build the image.
# It will download and install system dependencies and Android SDK on a
Ubuntu base image.
bash 110-docker_image_build.sh
# Build the project.
# It will:
# + copy the sources into a temporary directory,
# + mount the temporary project dir into the container
# + Attempt to build the project using `gradlew`
bash 210-run.sh
# A message should telle whether the build was successful or not.
# On success, the temporary directory will be deleted (otherwise will be
kept for debug).
Please note that it will use a lot of disk space (5-6 GB), and will take
quite some time depending on your host resources and internet connection
bandwidth.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<
#5 (comment)>,
or unsubscribe<
https://github.com/notifications/unsubscribe-auth/AO3XH7GSYLFE5L45A6TXE5LUJLOC5ANCNFSM4WMZMSFA>.
Triage notifications on the go with GitHub Mobile for iOS<
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android<
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS5SYPYRDXDGBJZIAGTBSWLUJLKD7ANCNFSM4WMZMSFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@originalheff It definitely is related to the container/env, but I'm not familiar enough with Lint 😅 Anyway, it built successfully when disabling Lint, so it should be reasonably possible to build in an environment other than yours. 👍 On my Linux host, with Android Studio I get some errors related to the
What's your environment ? I don't have much more time right now to dig into it, but I'd be interested in better understanding what's happening and how to fix it (at least on Linux). |
Hi
Windows 10 x64.
So I cannot get pass the gradle error, specified gradle distribution
https..... Does not exist.
Tried several websites but all fixes fails.
Regards
Lucanio
…On Fri, 29 Oct 2021, 19:45 Aloike, ***@***.***> wrote:
@originalheff <https://github.com/originalheff> It definitely is related
to the container/env, but I'm not familiar enough with Lint 😅 Anyway, it
built successfully when disabling Lint, so it should be reasonably possible
to build in an environment other than yours. 👍
On my Linux host, with Android Studio I get some errors related to the compile
'com.android.support:appcompat-v7:25.3.1' line from the file
app/build.gradle. I ran into this last year when I spent some time on
https://github.com/Td5OpenDiag/Td5OpenDiag-android.
@Lucanio4 <https://github.com/Lucanio4> :
- It will work on your model. As long as it's a Td5, it will be fine.
Some values might not be available, though.
- To change from USB to bluetooth, you probably will have to rewrite
most of the back-end.
- My Android Studio "has lived", so I definitely don't know what I've
locally done (hence my attempt at building in a container from scratch).
What's your environment ?
I don't have much more time right now to dig into it, but I'd be
interested in better understanding what's happening and how to fix it (at
least on Linux).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS5SYP5YWBGCFMOTFSP4BSDUJLTTTANCNFSM4WMZMSFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI Emoji";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:704868771;
mso-list-template-ids:-1;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->Howdy Got passed the Gradle error. Downloaded the zip file and extracted it to like 4 different places. Now I am stuck again. Gradle sync failed: Could not find com.android.tools.build:gradle:11. Searched in the following locations: - https://jcenter.bintray.com/com/android/tools/build/gradle/11/gradle-11.pom - https://jcenter.bintray.com/com/android/tools/build/gradle/11/gradle-11.jar Required by: project : Add google Maven repository and sync project Open File (13 s 673 ms) The websites doesn’t even exist.It was a lower version, but changing the version number shows the same message exept for the number. What do I do now? Regards From: Lucky LukeSent: Friday, 29 October 2021 8:09 PMTo: hairyone/TD5TesterCc: hairyone/TD5Tester; MentionSubject: Re: [hairyone/TD5Tester] Get the App (#5) Hi Windows 10 x64.So I cannot get pass the gradle error, specified gradle distribution https..... Does not exist.Tried several websites but all fixes fails. RegardsLucanio On Fri, 29 Oct 2021, 19:45 Aloike, ***@***.***> ***@***.*** It definitely is related to the container/env, but I'm not familiar enough with Lint 😅 Anyway, it built successfully when disabling Lint, so it should be reasonably possible to build in an environment other than yours. 👍On my Linux host, with Android Studio I get some errors related to the compile 'com.android.support:appcompat-v7:25.3.1' line from the file app/build.gradle. I ran into this last year when I spent some time on ***@***.*** :It will work on your model. As long as it's a Td5, it will be fine. Some values might not be available, though.To change from USB to bluetooth, you probably will have to rewrite most of the back-end.My Android Studio "has lived", so I definitely don't know what I've locally done (hence my attempt at building in a container from scratch).What's your environment ?I don't have much more time right now to dig into it, but I'd be interested in better understanding what's happening and how to fix it (at least on Linux).—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI Emoji";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:851457647;
mso-list-template-ids:-1;}
@list l0:level1
{mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level4
{mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level7
{mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->Afternoon Please see which versions of the supporting software is to be used. I tried many things and stuck on these errors. CheersLucanio From: Luke OberholzerSent: Friday, 29 October 2021 8:36 PMTo: hairyone/TD5TesterCc: hairyone/TD5Tester; MentionSubject: RE: [hairyone/TD5Tester] Get the App (#5) Howdy Got passed the Gradle error. Downloaded the zip file and extracted it to like 4 different places. Now I am stuck again. Gradle sync failed: Could not find com.android.tools.build:gradle:11. Searched in the following locations: - https://jcenter.bintray.com/com/android/tools/build/gradle/11/gradle-11.pom - https://jcenter.bintray.com/com/android/tools/build/gradle/11/gradle-11.jar Required by: project : Add google Maven repository and sync project Open File (13 s 673 ms) The websites doesn’t even exist.It was a lower version, but changing the version number shows the same message exept for the number. What do I do now? Regards From: Lucky LukeSent: Friday, 29 October 2021 8:09 PMTo: hairyone/TD5TesterCc: hairyone/TD5Tester; MentionSubject: Re: [hairyone/TD5Tester] Get the App (#5) Hi Windows 10 x64.So I cannot get pass the gradle error, specified gradle distribution https..... Does not exist.Tried several websites but all fixes fails. RegardsLucanio On Fri, 29 Oct 2021, 19:45 Aloike, ***@***.***> ***@***.*** It definitely is related to the container/env, but I'm not familiar enough with Lint 😅 Anyway, it built successfully when disabling Lint, so it should be reasonably possible to build in an environment other than yours. 👍On my Linux host, with Android Studio I get some errors related to the compile 'com.android.support:appcompat-v7:25.3.1' line from the file app/build.gradle. I ran into this last year when I spent some time on ***@***.*** :1.It will work on your model. As long as it's a Td5, it will be fine. Some values might not be available, though.2.To change from USB to bluetooth, you probably will have to rewrite most of the back-end.3.My Android Studio "has lived", so I definitely don't know what I've locally done (hence my attempt at building in a container from scratch).What's your environment ?I don't have much more time right now to dig into it, but I'd be interested in better understanding what's happening and how to fix it (at least on Linux).—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Hi @Aloike |
Hi @Lucanio4 , Yes, I can build the APK file. File attached. Please note:
I've been able to install it using both ADB ( I can build it through my Android Studio install, but I wanted to provide a solution that could work on any platform, and define a reference environment/commands for building/testing the app, with an emphasis on repeatability to gently move towards continuous integration. G'day! |
Related to hairyone/TD5Tester#5. Merge branch 'hairyone_TD5Tester_issue-0005-get_the_app' into dev-master
Merged here: https://github.com/Td5OpenDiag/Td5OpenDiag-android/tree/dev-master The Dockerfile provides all commands required to setup an Ubuntu system from scratch to build Android apps on it. Some complementary scripts are available under the scripts directory. They should provide enough automation (at least on Linux) to build the app in a docker container and to deploy the app on a mobile device. Hope that helps! |
Hi! where to find the td5 tester.apk? because i was trying to import the project to Android Studio to be able to package it and make the .apk file, but it says that there are some missing files.?¿?¿?
The text was updated successfully, but these errors were encountered: