Skip to content

Latest commit

 

History

History
114 lines (80 loc) · 3.54 KB

File metadata and controls

114 lines (80 loc) · 3.54 KB

Android Guide

This guide reflects the current Kotlin app under android/app.

Build Requirements

Setting Current value
compileSdk 35
targetSdk 35
minSdk 24
Java / JVM target 17
Kotlin 2.0.21

The version catalog lives in android/gradle/libs.versions.toml.

Build the App

cd android
.\gradlew assembleDebug

Install onto a connected device:

.\gradlew installDebug

Debug APK output:

android/app/build/outputs/apk/debug/app-debug.apk

Required Model Assets

The app expects both assets in android/app/src/main/assets/:

  • span_education_x3.tflite
  • span_education_x2.tflite

These are used by ModelManager to map input resolution to output target:

Input class Asset Output target
144p span_education_x3.tflite 360p
240p span_education_x3.tflite 720p
360p span_education_x2.tflite 720p

Converting and copying a model

models/conversion/convert_span_x3.py now handles both x3 and x2 SPAN checkpoints by inferring the scale from the checkpoint payload.

python models/conversion/convert_span_x3.py --checkpoint models/span/education-finetuned/x3-real-refine-20260412/best_model.pt --output_dir outputs/mobile-export/x3-real-refine-20260412 --tflite_name span_education_x3.tflite
python models/conversion/convert_span_x3.py --checkpoint models/span/education-finetuned/x2-v3-tpgsr-refine-20260411/last_model.pt --output_dir outputs/mobile-export/x2-v3-tpgsr-refine-20260411-last --tflite_name span_education_x2.tflite
copy outputs\mobile-export\x3-real-refine-20260412\span_education_x3.tflite android\app\src\main\assets\span_education_x3.tflite
copy outputs\mobile-export\x2-v3-tpgsr-refine-20260411-last\span_education_x2.tflite android\app\src\main\assets\span_education_x2.tflite

App Architecture at a Glance

Area Main files
application setup EduScaleApplication.kt
model loading and inference ml/ModelManager.kt
segment-based video pipeline processing/VideoProcessor.kt
desktop-like frame cache for single images processing/FrameEnhancer.kt
OCR and quality metrics processing/QualityMetrics.kt
downloads and enhancement jobs worker/VideoDownloadWorker.kt, worker/VideoEnhancementWorker.kt
persisted settings data/SettingsRepository.kt
UI state and screens ui/viewmodel/MainViewModel.kt, ui/screens/*

Background processing behavior

The Android app uses WorkManager for two queues:

  • video enhancement jobs
  • YouTube download jobs

Important storage locations:

Location Purpose
filesDir/enhanced_videos/ completed processed videos
filesDir/downloads/ downloaded source videos
DataStore settings user preferences such as GPU and cache options

Enhanced videos are shared through the app FileProvider declared in res/xml/file_paths.xml.

Testing

Local unit tests:

cd android
.\gradlew testDebugUnitTest

There are Kotlin tests for segment detection and bitmap sharpening under android/app/src/test/java/com/james/eduscale/processing/.

Common failures

  • Missing SDK: open the project once in Android Studio so local.properties is generated.
  • Missing assets: verify both TFLite files exist and are non-empty.
  • GPU delegate errors: CPU fallback is expected on unsupported devices.

Related Docs