From a52a4158a95fadb3e0d09d4ef04c0d1cb78c0317 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Wed, 10 May 2023 17:56:57 -0400 Subject: [PATCH] Android: improve kodev run (#10418) launch & uninstall the correct version do not rely on setup_env When paired with wireless debugging, this makes android debugging not such a pain. --- kodev | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kodev b/kodev index 1a8befffb..5d39dfeb5 100755 --- a/kodev +++ b/kodev @@ -110,8 +110,6 @@ function setup_env() { SETUP_ENV_GREP_COMMAND="grep -z -v debug" if [ -n "${KODEBUG}" ]; then SETUP_ENV_GREP_COMMAND="grep -z debug" - # for android adb install - KODEBUG_SUFFIX=-debug fi local files=() while IFS= read -r -d $'\0'; do @@ -811,16 +809,18 @@ TARGET: kodev-release --ignore-translation android assert_ret_zero $? fi - setup_env + if [ -n "${KODEBUG}" ]; then + KODEBUG_SUFFIX=-debug + fi # clear logcat to get rid of useless cruft adb logcat -c # uninstall existing package to make sure *everything* is gone from memory # no assert_ret_zero; uninstall is allowed to fail if there's nothing to uninstall - adb uninstall "org.koreader.launcher" + adb uninstall "org.koreader.launcher${KODEBUG_SUFFIX/-/.}" adb install "koreader-android-${ANDROID_ARCH}${KODEBUG_SUFFIX}-${VERSION}.apk" assert_ret_zero $? # there's no adb run so we do this… - adb shell monkey -p org.koreader.launcher -c android.intent.category.LAUNCHER 1 + adb shell monkey -p org.koreader.launcher${KODEBUG_SUFFIX/-/.} -c android.intent.category.LAUNCHER 1 assert_ret_zero $? adb logcat KOReader:V luajit-launcher:V "*:E" } || echo "Failed to find adb in PATH to interact with Android device."