Compare commits
20 commits
Author | SHA1 | Date | |
---|---|---|---|
2386b29233 | |||
947f057649 | |||
a2c5d60e17 | |||
dc86fdeb8b | |||
61c53c1fe4 | |||
f6261aebcd | |||
9a75e30ae0 | |||
452082de2a | |||
f1dcecf971 | |||
51734be9f8 | |||
1c4c210091 | |||
8785107ea5 | |||
bf535476ec | |||
07ab6c4ab1 | |||
7833f70173 | |||
6059e20bb5 | |||
b9b9e32b8b | |||
703e34f0b4 | |||
033219169b | |||
1a1b53aaa6 |
1
.bashrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
4
.gitignore
vendored
|
@ -1,5 +1,3 @@
|
||||||
*.apk
|
|
||||||
*.apk.install-log
|
|
||||||
apk/ToyKey.keystore
|
apk/ToyKey.keystore
|
||||||
apk/obj
|
apk/obj
|
||||||
apk/obj/*
|
apk/obj/*
|
||||||
|
@ -9,5 +7,3 @@ apk/result/
|
||||||
apk/result/*
|
apk/result/*
|
||||||
apk/bin/!.gitkeep
|
apk/bin/!.gitkeep
|
||||||
/example.app.apk
|
/example.app.apk
|
||||||
docker-compose-build.log
|
|
||||||
/Makefile.apps
|
|
||||||
|
|
26
Dockerfile
|
@ -1,42 +1,30 @@
|
||||||
FROM archlinux:latest
|
FROM archlinux:latest
|
||||||
|
|
||||||
ARG YESACCEPT=n
|
|
||||||
RUN echo "this is $YESACCEPT"
|
|
||||||
RUN pacman -Syu --noconfirm
|
RUN pacman -Syu --noconfirm
|
||||||
RUN pacman -S --noconfirm coreutils bash shadow make unzip zip jdk17-openjdk wget
|
RUN pacman -S --noconfirm coreutils bash shadow make unzip jdk11-openjdk wget
|
||||||
ENV ANDROID_SDK_ROOT="/opt/android"
|
ENV ANDROID_SDK_ROOT="/opt/android"
|
||||||
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
||||||
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
|
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
|
||||||
mkdir -p "$BUILD_TOOLS";\
|
mkdir -p "$BUILD_TOOLS";\
|
||||||
cd "$BUILD_TOOLS";\
|
cd "$BUILD_TOOLS";\
|
||||||
pwd;\
|
pwd;\
|
||||||
for LATESTTOOLS in \
|
wget -O cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip;\
|
||||||
"$(curl https://developer.android.com/studio#command-line-tools-only | grep -e 'https://dl.google.com/android/repository/commandlinetools-linux-.*_latest.zip' | cut -f2 -d'"')" \
|
unzip cmdline-tools.zip;\
|
||||||
'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip' ;\
|
|
||||||
do \
|
|
||||||
echo "testing to get '$LATESTTOOLS'";\
|
|
||||||
echo test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" ;\
|
|
||||||
test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" || { echo "unsure of URL $LATESTTOOLS correct, skipping it..." >&2; continue; }; \
|
|
||||||
wget -O cmdline-tools.zip "$LATESTTOOLS" ;\
|
|
||||||
unzip cmdline-tools.zip && break || { echo "error downloading working cmdline-tools.zip"; exit 1; };\
|
|
||||||
done;\
|
|
||||||
ls ;\
|
ls ;\
|
||||||
ls cmdline-tools;\
|
ls cmdline-tools;\
|
||||||
rm cmdline-tools.zip;\
|
rm cmdline-tools.zip;\
|
||||||
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
|
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
|
||||||
ENV PATH="$PATH:$BUILD_TOOLS_LATEST/bin"
|
ENV PATH="$PATH:$BUILD_TOOLS_LATEST/bin"
|
||||||
#TODO make this automatic
|
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk/"
|
||||||
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk/"
|
#ENTRYPOINT bash -c 'sleep 10000'
|
||||||
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
|
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
|
||||||
|
ARG YESACCEPT=n
|
||||||
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
|
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
|
||||||
RUN echo you selected to accept the licenses/TOS
|
RUN echo you selected to accept the licenses/TOS
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
|
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
|
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
|
||||||
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
|
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
|
||||||
#RUN echo "$YESACCEPT" | sdkmanager --install "system-images;android-33;aosp_atd;x86_64"
|
#RUN apk add setpriv
|
||||||
#RUN echo "$YESACCEPT" | sdkmanager --install "emulator"
|
|
||||||
#RUN echo "no" | avdmanager --verbose create avd --force --name "thedevice" --package 'system-images;android-33;aosp_atd;x86_64' --tag "aosp_atd" --abi "x86_64"
|
|
||||||
#RUN echo "$YESACCEPT" | sdkmanager --install "platform-tools"
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chown 0:0 /entrypoint.sh
|
RUN chown 0:0 /entrypoint.sh
|
||||||
RUN chmod 0700 /entrypoint.sh
|
RUN chmod 0700 /entrypoint.sh
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Ideas and todos
|
|
||||||
|
|
||||||
## 1. EMULATOR: enable a way to have the "sdk emulator" running
|
|
||||||
|
|
||||||
this is attempted in the `emulator` branch. Challenges comprise:
|
|
||||||
|
|
||||||
* Xorg server must be forwarded (and other stuff like sound etc)
|
|
||||||
* the emulator itself might need to have `docker .... --device` setup for `/dev/kvm` probably (and at that point it might be
|
|
||||||
better to have it all run natively inside a VM anyways... (alternative would be nested virutalization)
|
|
||||||
|
|
||||||
|
|
||||||
## 2. BUILD and PACKAGENAME improvements
|
|
||||||
|
|
||||||
### status quo: 2 Makefiles (gnu make) are involved,
|
|
||||||
* a) one being the outer one that uses Makefile.apps as an include and then
|
|
||||||
* b) an inner one located at `./apps/<app-name>/Makefile`
|
|
||||||
|
|
||||||
the inner-one is not "parametrized" and at present has explicit nameing of the android app/ package (i.e. `example.app`),
|
|
||||||
which comes with the additional negative that one has several files that need to be adjusted, this also being true
|
|
||||||
because of the "fun that JAVA" naming conventions which basically means that the very least those files all have to
|
|
||||||
be kept in sync
|
|
||||||
|
|
||||||
* `./apps/<app-name>/AndroidManifest.xml`
|
|
||||||
* `./apps/<app-name>/Makefile`
|
|
||||||
* `./apps/<app-name>/src/<package-name>/<activity-name>.java`
|
|
||||||
|
|
||||||
### goal: attempt to have the `<app-name>`, `<package-name>` and `<package-name>` be abstracted
|
|
||||||
|
|
||||||
Ideally make the inner Makefile superfluous
|
|
||||||
|
|
||||||
|
|
||||||
## 3. ALLOW KOTLIN
|
|
||||||
|
|
||||||
Since Java was apparently not "good/fancy" enough of maybe "bloated" the hippster did do what they like best
|
|
||||||
re-invent to garnish personal "pride/achievement" and thus make a unhelpful thing (java) into now 2 unhelpful
|
|
||||||
things (i.e. Kotlin and Java) super!
|
|
||||||
However oftentimes now the undesired-yet-existing-kotlin is there and a goal could be to enable it being used.
|
|
||||||
After all it appears to be a tiny bit less of a boilerplate annoyance...
|
|
||||||
|
|
||||||
## 4. ALLOW GRADLEBUILDS
|
|
||||||
|
|
||||||
GRADLE is often used as a building system for apps, it would be beneficial to have those build run also
|
|
||||||
in this `android-docker-app` thing
|
|
33
Makefile
|
@ -1,18 +1,29 @@
|
||||||
|
|
||||||
# this includes explicit rules
|
|
||||||
include Makefile.apps
|
|
||||||
Makefile.apps: Makefile apps
|
|
||||||
@./Makefile.make.Makefile.apps.sh
|
|
||||||
|
|
||||||
apps:
|
all: build install
|
||||||
mkdir "$@"
|
|
||||||
|
|
||||||
install: $(shell for APP in apps/*/; do test -d "$$APP" || continue; echo "$$APP""app.apk.install-log"; done)
|
build:
|
||||||
force-install reinstall:
|
docker-compose run --rm compile
|
||||||
for APP in apps/*/; do rm -f "$$APP""app.apk.install-log" 2>/dev/null; done; $(MAKE) install
|
ln -sf apk/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
|
||||||
run: $(shell cd apps/; for APP in */; do test -d "$$APP" || continue; echo "run-$${APP%/}"; done)
|
|
||||||
|
|
||||||
docker-compose-build.log: Dockerfile compose.yml
|
install:
|
||||||
|
adb install -r ./example.app.apk
|
||||||
|
|
||||||
|
.PHONY: clean-all
|
||||||
|
clean-all: clean-docker clean-apk
|
||||||
|
|
||||||
|
.PHONY: clean-docker
|
||||||
|
clean-docker:
|
||||||
|
rm docker-compose-build.log || true
|
||||||
|
docker-compose down --remove-orphans --rmi all
|
||||||
|
|
||||||
|
.PHONY: clean-apk
|
||||||
|
clean-apk:
|
||||||
|
cd apk && $(MAKE) clean
|
||||||
|
|
||||||
|
|
||||||
|
docker-compose-build.log: Dockerfile docker-compose.yml
|
||||||
docker-compose down --remove-orphans --rmi all
|
docker-compose down --remove-orphans --rmi all
|
||||||
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log
|
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
(
|
|
||||||
set -xe
|
|
||||||
cd apps
|
|
||||||
for APP in */
|
|
||||||
do
|
|
||||||
test -d "$APP" || continue;
|
|
||||||
APP="${APP%/}";
|
|
||||||
cat << MAKEFILE
|
|
||||||
apps/$APP/app.apk: docker-compose-build.log
|
|
||||||
docker compose run --rm compile $APP
|
|
||||||
build-$APP: apps/$APP/app.apk
|
|
||||||
true
|
|
||||||
apps/$APP/app.apk.install-log: apps/$APP/app.apk
|
|
||||||
adb install -r $< > \$@ || rm \$@
|
|
||||||
install-$APP: apps/$APP/app.apk.install-log
|
|
||||||
true
|
|
||||||
run-$APP: apps/$APP/app.apk.install-log
|
|
||||||
adb shell am start -n app.example/.ExampleApp
|
|
||||||
MAKEFILE
|
|
||||||
done
|
|
||||||
) > Makefile.apps
|
|
21
README.md
|
@ -1,11 +1,28 @@
|
||||||
# Repo allowing -in a KISS way- to create a containered way to build an Android App APK
|
# Repo allowing -in a KISS way- to create a containered way to build an Android App APK
|
||||||
|
|
||||||
## brach `no-res.xml`
|
|
||||||
|
## branchs
|
||||||
|
|
||||||
|
### branch `native`
|
||||||
|
|
||||||
|
this branch should allow to use the Native Developer Kit to build an app without much java
|
||||||
|
the content below apk/native are LICENSE MIT
|
||||||
|
|
||||||
|
### branch `no-res.xml`
|
||||||
|
|
||||||
this branch features the exmaple.app to not require the compoletely bogus unneeded requirement
|
this branch features the exmaple.app to not require the compoletely bogus unneeded requirement
|
||||||
to setup a `./apk/res/layouts/res.xml` file to setup the layout to be used.
|
to setup a `./apk/res/layouts/res.xml` file to setup the layout to be used.
|
||||||
Instead a layout is created inline
|
Instead a layout is created inline
|
||||||
|
|
||||||
|
### branch `webview`
|
||||||
|
|
||||||
|
a bra
|
||||||
|
## changelog
|
||||||
|
|
||||||
|
* using https://android.googlesource.com/platform/cts/+/android-7.1.1_r13/tests/tests/webkit/src/android/webkit/cts/PostMessageTest.java derived
|
||||||
|
webmessage to send data to Javascript/Webview from Java (using a timer)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## tl;dr
|
## tl;dr
|
||||||
|
|
||||||
|
@ -27,7 +44,7 @@ This will generate the APK file `./apk/example.app.apk`
|
||||||
|
|
||||||
this can be installed via `adb`
|
this can be installed via `adb`
|
||||||
```
|
```
|
||||||
adb install -r ./apk/example.app.apk
|
adb install -r ./example.app.apk
|
||||||
# or alternative type
|
# or alternative type
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
||||||
<activity android:name="app.example.ExampleApp"
|
<activity android:name="app.example.ExampleApp"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
|
@ -15,7 +15,6 @@ all: build
|
||||||
.PHONY : clean
|
.PHONY : clean
|
||||||
|
|
||||||
build : ./result/example.app.apk
|
build : ./result/example.app.apk
|
||||||
mv ./result/example.app.apk app.apk
|
|
||||||
true
|
true
|
||||||
|
|
||||||
env:
|
env:
|
|
@ -1,9 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
|
||||||
</head>
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function sleepit(ms) {
|
function sleepit(ms) {
|
||||||
|
@ -105,7 +101,6 @@ function divMessage(html){
|
||||||
<a href='https://html5test.co/'>https://html5test.co/</a>
|
<a href='https://html5test.co/'>https://html5test.co/</a>
|
||||||
<h1> this is html <h1>
|
<h1> this is html <h1>
|
||||||
<h2> this is a h2</h2>
|
<h2> this is a h2</h2>
|
||||||
<input type=text />
|
|
||||||
<img src='https://wald.alexmahr.de/images/bear.avif'>
|
<img src='https://wald.alexmahr.de/images/bear.avif'>
|
||||||
<img src='https://wald.alexmahr.de/images/delphin.avif'>
|
<img src='https://wald.alexmahr.de/images/delphin.avif'>
|
||||||
</html>
|
</html>
|
0
apk/bin/.gitkeep
Normal file
1
apk/example.app.apk
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
./bin/example.app.apk
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -13,7 +13,6 @@ import android.view.*;
|
||||||
//import android.view.MenuItem;
|
//import android.view.MenuItem;
|
||||||
import android.view.ViewGroup.*;
|
import android.view.ViewGroup.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
//import android.widget.Toast;
|
|
||||||
//import android.widget.TextView;
|
//import android.widget.TextView;
|
||||||
import android.webkit.*;
|
import android.webkit.*;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -158,16 +157,12 @@ public class ExampleApp extends Activity {
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
// Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package: app.example"));// + BuildConfig.APPLICATION_ID));
|
// Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package: app.example"));// + BuildConfig.APPLICATION_ID));
|
||||||
if(!Environment.isExternalStorageManager()){
|
Intent intent = new Intent();
|
||||||
Intent intent = new Intent();
|
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||||
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
|
||||||
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
|
|
||||||
intent.setData(uri);
|
|
||||||
startActivity(intent);
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "berechtigt", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
//intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
//intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
||||||
|
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
|
||||||
|
intent.setData(uri);
|
||||||
|
startActivity(intent);
|
||||||
// startActivityForResult(intent, APP_STORAGE_ACCESS_REQUEST_CODE);
|
// startActivityForResult(intent, APP_STORAGE_ACCESS_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
9
apps/webview/.gitignore
vendored
|
@ -1,9 +0,0 @@
|
||||||
/ToyKey.keystore
|
|
||||||
/obj
|
|
||||||
/obj/*
|
|
||||||
/bin/*
|
|
||||||
!/bin/.gitkeep
|
|
||||||
/result
|
|
||||||
/result/
|
|
||||||
/result/*
|
|
||||||
/example.app.apk
|
|
12
compose.yml
|
@ -1,16 +1,10 @@
|
||||||
services:
|
services:
|
||||||
compile:
|
compile:
|
||||||
hostname: thinkbox
|
hostname: android-app-builder
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
YESACCEPT: ${YESACCEPT:-}
|
YESACCEPT: ${YESACCEPT:-n}
|
||||||
stop_grace_period: 1s
|
stop_grace_period: 1s
|
||||||
environment:
|
|
||||||
XAUTHORITY: /root/.Xauthority
|
|
||||||
DISPLAY: ":0"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./apps:/apps
|
- ./apk:/apk
|
||||||
- /home/alex/.Xauthority:/root/.Xauthority:ro
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -x
|
cd /apk;
|
||||||
|
VOLUID="$(stat -c "%u" /apk)";
|
||||||
|
VOLGID="$(stat -c "%g" /apk)";
|
||||||
APKDIR="/apps/$1"
|
CMD="${*:-"make"}"
|
||||||
shift
|
setpriv --reuid $VOLUID --regid $VOLGID --clear-groups sh -c "$CMD"
|
||||||
#test -d "$1" ==
|
|
||||||
#APKDIR=
|
|
||||||
#cd /apk/$1;
|
|
||||||
#shift
|
|
||||||
VOLUID="$(stat -c "%u" "$APKDIR")";
|
|
||||||
VOLGID="$(stat -c "%g" "$APKDIR")";
|
|
||||||
#CMD="${*:-"make"}"
|
|
||||||
cd "$APKDIR"
|
|
||||||
test -z "$*" && set -- make
|
|
||||||
setpriv --reuid $VOLUID --regid $VOLGID --clear-groups sh -c "$*"
|
|
||||||
|
|
||||||
|
|