diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..1b90d665 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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 + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..777a3c22 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + ], +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index c8a62af9..98c573ea 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ proguard.cfg proguard-project.txt .gradle build +.env diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..38aab464 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 0091d532..9352efe6 100644 --- a/README.md +++ b/README.md @@ -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" ### Translating the UI diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 70122a94..7f77e000 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -90,6 +90,7 @@ android:theme="@style/SMSBackupPlusTheme.Light" android:name="App" android:allowBackup="true" + android:debuggable="false" android:fullBackupContent="@xml/backup_descriptor">