Scaffold and first working build of an Android app that reproduces the iOS YouTube Kids interface over a local folder: shelves of 16:9 rounded thumbnails, fullscreen player, bottom bar, search grid and a parent gate. - minSdk 21, AGP 8.13.2 / Gradle 8.13 / Kotlin 2.1.20, compileSdk 35 - library from Movies/KidsTube via MediaStore, or a SAF tree the parent picks - no INTERNET permission: verified against the built APK with aapt2 - thumbnails decoded once into filesDir and cached, never on the bind path - player: VideoView, immersive, chrome auto-hides, tap_catcher restores it Verified on the AGS2-W09 (API 30): shelves with real frames, playback, search filtering, parent gate, back navigation.
5.4 KiB
KidsTube
Android app that reproduces the iOS YouTube Kids interface — thumbnail shelves, fullscreen player, bottom bar — while playing video from a local folder only. No network, no account, no recommendations. It exists because the son accepts the iOS kids UI and rejects the Android one, so this is a convincing shell around local files. Floor: Android 5.0 / API 21. App name: KidsTube.
State 2026-10-28: builds, installs and plays on the target tablet; shelves, search, player and the parent gate were verified on the device.
Non-negotiables
- No network. The APK must carry no
INTERNETpermission and no HTTP client:unzip -p app/build/outputs/apk/debug/app-debug.apk AndroidManifest.xml | strings | grep -ci internetmust print0, and/home/lotherk/android-sdk/build-tools/35.0.0/aapt2 dump permissions app/build/outputs/apk/debug/app-debug.apkmust list only the two storage permissions. minSdkstays 21. Check any new AAR'sminSdkbefore adding it — much of current androidx sits at 23+.- When the choice is "Material default" vs "the iOS app's proportions", take iOS.
Environment (this machine, verified)
- JDK 21 (
/usr/lib/jvm/java-21-openjdk-amd64); no JDK 8 or 17 installed. - SDK lives in
/home/lotherk/android-sdk(user-local). The distro's/usr/lib/android-sdkhas noplatforms/orbuild-tools/, and its bundledsdkmanager/apkanalyzerdie on JDK 21 withNoClassDefFoundError: javax/xml/bind/annotation/XmlSchema(JAXB removed in JDK 11) — do not use it. gradleis not on PATH; the standalone distribution is/home/lotherk/android-tools/gradle-8.13. The wrapper is pinned to 8.13 andlocal.propertiespoints at the SDK.- AGP 8.13.2, Kotlin 2.1.20, compileSdk 35, build-tools 35.0.0. AGP 8.13 requires Gradle >= 8.13, Build-Tools >= 35.0.0, JDK >= 17.
Build, install, run
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
export ANDROID_HOME=/home/lotherk/android-sdk
./gradlew :app:assembleDebug # apk -> app/build/outputs/apk/debug/
./gradlew :app:lintDebug # must stay green; abortOnError = true
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell pm grant dev.lotherk.kidstube android.permission.READ_EXTERNAL_STORAGE
adb shell am start -n dev.lotherk.kidstube/.ui.MainActivity
adb exec-out screencap -p > /tmp/kt.png
adb logcat -d | grep -E 'kidstube|AndroidRuntime'
Target device: Huawei AGS2-W09, LineageOS 18.1 (18.1-20220523-UNOFFICIAL-prague),
Android 11 / API 30, arm64-v8a, 1200x1920 at 480 dpi = 400dp wide. API 21 cannot
be exercised here — that needs an emulator image and none is installed.
Content
The library is Movies/KidsTube (/storage/emulated/0/Movies/KidsTube), scanned
through MediaStore; a SAF tree picked from the Profile screen takes precedence.
Copy files with
adb push video.mp4 /sdcard/Movies/KidsTube/
adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/Movies/KidsTube/video.mp4
The broadcast is not optional: a pushed file stays invisible until MediaStore
indexes it, and from API 29 scoped storage forbids directory listing (the app uid
gets EACCES), so there is no fallback route.
Layout and conventions
data/—Library(SAF tree, else MediaStore; folder grouping;MediaItemcarries a sha1key),MediaItem.media/ThumbCache— decode viaMediaMetadataRetriever, write JPEGs tofilesDir/thumbs,LruCachein memory, 3-thread pool, tag-guarded binds.ui/—MainActivity(shelves, search grid, parent gate),SectionAdapter(vertical shelves, each a horizontal RecyclerView),VideoAdapter(modes HERO / CAROUSEL / GRID),PlayerActivity(VideoView, immersive, auto-hiding chrome),ThumbView.ThumbViewowns the two numbers the look depends on — 16:9 and 12dp corner radius — plus the duration pill. Never re-implement them per layout.- Kotlin + Views + AppCompat, single
:appmodule, viewBinding, no Compose. Every dimension in dp/sp, designed against 400dp width.
Pitfalls
reload()must treat "no SAF tree, storage permission granted" as a valid source. Gating on the tree alone silently shows an empty home screen.VideoViewswallows touches, so itsOnClickListenernever fires; the player uses a transparenttap_catcherview above it to bring the chrome back.- Tint AppCompat widgets with
app:tint, neverandroid:tint— lint fails the build onUseAppTint, and the vector drawables are white by default, so a missing tint makes an icon invisible rather than obviously wrong. - The system "Viewing full screen" confirmation appears on first launch and holds focus — dismiss it before trusting any UI dump.
uiautomator dumptakes seconds here, longer than the 4s chrome timeout, so a dump right after a tap shows stale state. Screenshot instead.- adbd on the device crash-loops (
Could not install *smartsocket* listener); a droppedadbconnection is the device, not the app. Reconnect and checksys.boot_completed. - The tablet randomly brings up the camera app between commands. Force-stop
com.android.camera2and restart the activity if the focus looks wrong. - File paths:
/storage/emulated/0is the real mount;/sdcardworks forlsbut not fordf.
Repo
Initialised locally (one commit), no remote yet; Konrad's convention is origin
= hiddenbox when one is added. Short imperative commit subjects, no
conventional-commit prefixes.