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.
reviewable/pr10425/r1
yparitcher 1 year ago committed by GitHub
parent d8b3878e8a
commit a52a4158a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
kodev

@ -110,8 +110,6 @@ function setup_env() {
SETUP_ENV_GREP_COMMAND="grep -z -v debug" SETUP_ENV_GREP_COMMAND="grep -z -v debug"
if [ -n "${KODEBUG}" ]; then if [ -n "${KODEBUG}" ]; then
SETUP_ENV_GREP_COMMAND="grep -z debug" SETUP_ENV_GREP_COMMAND="grep -z debug"
# for android adb install
KODEBUG_SUFFIX=-debug
fi fi
local files=() local files=()
while IFS= read -r -d $'\0'; do while IFS= read -r -d $'\0'; do
@ -811,16 +809,18 @@ TARGET:
kodev-release --ignore-translation android kodev-release --ignore-translation android
assert_ret_zero $? assert_ret_zero $?
fi fi
setup_env if [ -n "${KODEBUG}" ]; then
KODEBUG_SUFFIX=-debug
fi
# clear logcat to get rid of useless cruft # clear logcat to get rid of useless cruft
adb logcat -c adb logcat -c
# uninstall existing package to make sure *everything* is gone from memory # 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 # 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" adb install "koreader-android-${ANDROID_ARCH}${KODEBUG_SUFFIX}-${VERSION}.apk"
assert_ret_zero $? assert_ret_zero $?
# there's no adb run so we do this… # 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 $? assert_ret_zero $?
adb logcat KOReader:V luajit-launcher:V "*:E" adb logcat KOReader:V luajit-launcher:V "*:E"
} || echo "Failed to find adb in PATH to interact with Android device." } || echo "Failed to find adb in PATH to interact with Android device."

Loading…
Cancel
Save