Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Build: install a minified release APK and precompile it

leovvaydf87d0e2ec12
diff --git a/launcher/app/build.gradle b/launcher/app/build.gradle
index ad63fe3d3..908cc02b0 100644
--- a/launcher/app/build.gradle
+++ b/launcher/app/build.gradle
@@ -16,7 +16,12 @@ android {
buildTypes {
release {
- minifyEnabled false
+ // R8 strips and optimises the code (AndroidX included): smaller APK, faster start on a slow TV CPU.
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
+ // Sideloaded over ADB, never published: sign with the debug key so it installs over a debug build.
+ signingConfig signingConfigs.debug
}
}
diff --git a/launcher/build-and-install.ps1 b/launcher/build-and-install.ps1
index eaab3dc74..684076b74 100644
--- a/launcher/build-and-install.ps1
+++ b/launcher/build-and-install.ps1
@@ -25,11 +25,11 @@ if (-not (Test-Path local.properties)) {
"sdk.dir=$($sdk -replace '\\', '\\')" | Out-File -Encoding ascii local.properties
}
-.\gradlew.bat assembleDebug -q --console=plain
+.\gradlew.bat assembleRelease -q --console=plain
if ($LASTEXITCODE -ne 0) { throw 'Gradle build failed' }
$py = '..\tools\venv\Scripts\python.exe'
-$apk = 'app\build\outputs\apk\debug\app-debug.apk'
+$apk = 'app\build\outputs\apk\release\app-release.apk'
& $py -I ..\tools\b64push.py $apk /data/local/tmp/tvhome.apk
if ($LASTEXITCODE -ne 0) { throw 'APK upload failed' }
$out = & $py -I ..\tools\tv.py 'pm install -r /data/local/tmp/tvhome.apk; rm -f /data/local/tmp/tvhome.apk'
@@ -40,6 +40,7 @@ Write-Host $out
if ("$out" -match 'Error') { throw 'could not set the new launcher as home; the stock launcher was left untouched' }
@(
'pm grant com.gathin.tvhome android.permission.ACCESS_FINE_LOCATION 2>/dev/null; echo location-granted',
+ 'cmd package compile -m speed -f com.gathin.tvhome',
'cmd package set-home-activity --user 0 com.gathin.tvhome',
"pm disable-user --user 0 $StockLauncher"
) | & $py -I ..\tools\tv.py --batch
diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.sh
index 9c9d2ed19..30fc3f8b1 100755
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@ -8,16 +8,17 @@ export JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home -v 17 2>/dev/null || ech
export ANDROID_HOME="${ANDROID_HOME:-$([ -d ~/Library/Android/sdk ] && echo ~/Library/Android/sdk || echo /opt/homebrew/share/android-commandlinetools)}"
export PATH="$JAVA_HOME/bin:$PATH"
[ -f local.properties ] || echo "sdk.dir=$ANDROID_HOME" > local.properties
-./gradlew assembleDebug -q --console=plain
+./gradlew assembleRelease -q --console=plain
PY=../tools/venv/bin/python
[ -x "$PY" ] || PY=../tools/venv/Scripts/python.exe
export MSYS_NO_PATHCONV=1
-APK=app/build/outputs/apk/debug/app-debug.apk
+APK=app/build/outputs/apk/release/app-release.apk
"$PY" -I ../tools/b64push.py "$APK" /data/local/tmp/tvhome.apk
printf '%s\n' \
"pm install -r /data/local/tmp/tvhome.apk" \
"rm -f /data/local/tmp/tvhome.apk" \
"pm grant com.gathin.tvhome android.permission.ACCESS_FINE_LOCATION 2>/dev/null; echo location-granted" \
+ "cmd package compile -m speed -f com.gathin.tvhome" \
"cmd package set-home-activity --user 0 com.gathin.tvhome/.MainActivity" \
"pm disable-user --user 0 $STOCK_LAUNCHER" \
| "$PY" -I ../tools/tv.py --batch