From 07b4c81207dfa550f13676da3081def28c336ca6 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 18 Aug 2026 02:53:17 -0400 Subject: [PATCH] [FIX] todo qemu: find the APK where AGP writes it, and install it as it is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The app runs in the emulator now, and two of my own checks were wrong. With an injected ABI, AGP writes to intermediates/apk/debug, not outputs/apk/debug: a SUCCESSFUL build was reported "no APK produced" because only the second path was searched. That same mode marks the APK testOnly, so adb refuses it without -t — INSTALL_FAILED_TEST_ONLY. Both measured on the emulator, where ca.erplibre.home then installed, launched, and ran its SQLite migrations. The manifest also stops tracking sentencepiece at master, which made the build non-reproducible and, since August, unbuildable: master fetches protobuf and compiles protoc for the Android target before running it on the host. v0.2.1 ships its .pb.cc pre-generated. Its own absl subset still lacks flags/flag.cc, so that library remains to be sorted out upstream. --- FR --- L'application tourne dans l'émulateur, et deux de mes propres contrôles étaient faux. Avec une ABI injectée, AGP écrit dans intermediates/apk/debug et non dans outputs/apk/debug : une compilation RÉUSSIE était rapportée « aucun APK produit » parce que je ne regardais que le second chemin. Ce même mode marque l'APK testOnly, et adb le refuse sans -t — INSTALL_FAILED_TEST_ONLY. Les deux mesurés sur l'émulateur, où ca.erplibre.home s'est ensuite installé, lancé, et a joué ses migrations SQLite. Le manifeste cesse aussi de suivre sentencepiece à master, ce qui rendait la compilation non reproductible et, depuis août, impossible : master récupère protobuf et compile protoc pour la cible Android avant de l'exécuter sur l'hôte. La v0.2.1 livre ses .pb.cc pré-générés. Son propre sous-ensemble absl manque encore flags/flag.cc : cette bibliothèque reste à régler en amont. Assisted-by: Claude Opus 5 --- manifest/git_manifest_mobile_home.xml | 12 ++++++++++-- script/todo/todo.py | 15 +++++++++++++-- test/test_qemu_desktop_tools.py | 7 +++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/manifest/git_manifest_mobile_home.xml b/manifest/git_manifest_mobile_home.xml index 54d42ec..e91fffa 100644 --- a/manifest/git_manifest_mobile_home.xml +++ b/manifest/git_manifest_mobile_home.xml @@ -12,12 +12,20 @@ groups="mobile" /> - + diff --git a/script/todo/todo.py b/script/todo/todo.py index 48f4394..a0a6238 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -5859,8 +5859,16 @@ class TODO: f"'cd {el_dir}/mobile/erplibre_home_mobile && npm test' && " # L'APK est la preuve, pas le code de sortie de Gradle : une tâche # peut rendre 0 sans avoir rien produit. + # DEUX emplacements, et il faut les deux. Avec une ABI injectée, + # AGP écrit dans « intermediates/apk/debug » et non dans + # « outputs/apk/debug » : mesuré, une compilation RÉUSSIE était + # rapportée « aucun APK produit » parce que je ne regardais que le + # second. Un contrôle qui cherche au mauvais endroit ne vaut pas + # mieux que pas de contrôle. f"apk=$(ls {el_dir}/mobile/erplibre_home_mobile/android/app/build" - "/outputs/apk/debug/*.apk 2>/dev/null | head -1); " + "/outputs/apk/debug/*.apk " + f"{el_dir}/mobile/erplibre_home_mobile/android/app/build" + "/intermediates/apk/debug/*.apk 2>/dev/null | head -1); " 'if [ -n "$apk" ]; then ' f'echo " ✅ {t("APK built:")} $apk"; ' # Capacitor sert la même application dans un navigateur : sur une @@ -5948,7 +5956,10 @@ class TODO: f'echo " {t("open it from your workstation:")} ' 'ssh -X erplibre@$ip \\"$HOME/android/emulator/emulator -avd erplibre -no-audio\\""; ' f'echo " {t("then install the APK:")} ' - 'ssh erplibre@$ip \\"$HOME/android/platform-tools/adb install -r ' + # « -t » : l'ABI injectée fait marquer l'APK « testOnly » par AGP, + # et adb le refuse sans ce drapeau — « INSTALL_FAILED_TEST_ONLY ». + # Mesuré sur l'émulateur. + 'ssh erplibre@$ip \\"$HOME/android/platform-tools/adb install -r -t ' f"{el_dir}/mobile/erplibre_home_mobile/android/app/build" '/outputs/apk/debug/app-debug.apk\\""' ) diff --git a/test/test_qemu_desktop_tools.py b/test/test_qemu_desktop_tools.py index e2db8e6..e31e268 100644 --- a/test/test_qemu_desktop_tools.py +++ b/test/test_qemu_desktop_tools.py @@ -339,6 +339,13 @@ class TestMobileBuild(unittest.TestCase): cmd = self.todo._qemu_mobile_remote_cmd() self.assertIn("outputs/apk/debug/*.apk", cmd) + def test_both_apk_locations_are_searched(self): + """Avec une ABI injectée, AGP écrit dans intermediates et non dans + outputs : mesuré, une compilation RÉUSSIE était rapportée « aucun APK + produit » parce qu'un seul des deux chemins était regardé.""" + cmd = self.todo._qemu_mobile_remote_cmd() + self.assertIn("intermediates/apk/debug/*.apk", cmd) + def test_no_apk_means_non_zero(self): """Éprouvé plutôt que relu : sans APK, le bloc DOIT rendre non nul. Une ligne d'information placée après le « fi » suffisait à rendre 0 et