Skip to content
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

add docker-environment #1103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu/.devcontainer/base.Dockerfile

# [Choice] Ubuntu version: bionic, focal
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get -y install --no-install-recommends openjdk-8-jdk

ENV ANDROID_SDK_ROOT "/usr/lib/android-sdk"

ENV PATH "$PATH:$ANDROID_SDK_ROOT/platform-tools"

RUN mkdir -p $ANDROID_SDK_ROOT && chmod 777 $ANDROID_SDK_ROOT && \
cd $ANDROID_SDK_ROOT && \
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip && \
unzip platform-tools-latest-linux.zip

RUN cd $ANDROID_SDK_ROOT && \
mkdir cmdline-tools && cd cmdline-tools && \
wget https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip && \
unzip commandlinetools-linux-*.zip && mv cmdline-tools latest && yes | latest/bin/sdkmanager --licenses

26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic
"args": {
"VARIANT": "focal"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"adelphes.android-dev-ext",
"vscjava.vscode-java-pack"
],
"remoteUser": "vscode",
"runArgs": [
"--env-file",
"${localWorkspaceFolder}/.devcontainer/.env"
],
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ proguard.cfg
proguard-project.txt
.gradle
build
.env
46 changes: 46 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "android",
"request": "launch",
"name": "Debug App",
"appSrcRoot": "${workspaceRoot}/app/src/main",
"apkFile": "${workspaceRoot}/app/build/outputs/apk/debug/app-debug.apk",
"adbSocket": "localhost:5037",
"autoStartADB": true,
"staleBuild": "warn",
"targetDevice": "",
"manifestFile": "${workspaceRoot}/app/src/main/AndroidManifest.xml",
"pmInstallArgs": [
"-r"
],
"amStartArgs": [
"-D",
"--activity-brought-to-front",
"-a android.intent.action.MAIN",
"-n com.zegoggles.smssync/com.zegoggles.smssync.activity.MainActivity"
],
"postLaunchPause": 1000,
"trace": false
},
{
"type": "node-terminal",
"request": "launch",
"name": "Build App",
"command": "./gradlew assembleDebug && sleep 5 && exit"
},
{
"type": "node-terminal",
"request": "launch",
"name": "Kill adb",
"command": "adb kill-server && sleep 5 && exit"
},
{
"type": "node-terminal",
"request": "launch",
"name": "Connect adb",
"command": "adb connect ${mobiledev} && sleep 5 && exit"
}
]
}
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,16 @@ which often has more recent versions than what is available on the Play Store.
$ git clone https://github.com/jberkel/sms-backup-plus.git
$ cd sms-backup-plus
$ ./gradlew assembleDebug
$ adb install app/build/outputs/apk/app-debug.apk
$ adb install app/build/outputs/apk/debug/app-debug.apk

### Usage of docker
#### Connecting via Wifi
- connect with USB-Connection and enter: adb tcpip [arbitrary port]
- create .env-file in .devcontainer and add: mobiledev=[ipaddress of phone:same arbitrary port]
- after starting with docker launch "Connect adb"
- if something goes wrong launch "Kill adb"
- Add android:debuggable="true" to AndroidManifest.xml to start in debug-mode
- then you can launch "Build App" and "Debug App"

### <a id="translating">Translating the UI</a>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
android:theme="@style/SMSBackupPlusTheme.Light"
android:name="App"
android:allowBackup="true"
android:debuggable="false"
android:fullBackupContent="@xml/backup_descriptor">

<activity android:name=".activity.MainActivity" android:label="@string/app_name">
Expand Down