Skip to content

ApkPy 1.12.1

Released 2026-10-06. python -m pip install --upgrade apkpy==1.12.1.

One fix, and nothing else. 1.12.1 is 1.12.0 with a comparison between two values put right. If your app compares two values that are not written out in the source, upgrade and build it again.

What was wrong

def check():
    if password.get_value() == again.get_value():
        toast("They match")

At the desk this did what it says. On the phone it asked whether the first field was empty.

The right side of a comparison in an if or an elif reached the phone only when it was written out in the source, like "abc" or 3. Anything else -- a name, a field's value, the answer of a call, a sum, a number below zero, a name defined at the top of the file -- became empty text, and the build said nothing. The Previewer runs your Python, so it always answered correctly: the two disagreed only on a phone. It has been so since at least 1.8.0.

You wrote On the phone, up to 1.12.0 1.12.1
if a == b: true only when a was empty true when the two are the same
if a != b: true whenever a was not empty true when they differ
if i < n: never true compares the two numbers
if n > -1: true whenever n held anything compares the two numbers
if n > LIMIT: with LIMIT = 10 at the top true whenever n held anything compares the two numbers
while i < n: compared as text: stopped at 2 when n was 12 compares the two numbers
if name == "Ana": right unchanged
if count > 3: right unchanged

A while, and / or, not and a if test else b already read both sides. Their fault was the one in the while row: two numbers that were not written out were compared as text, and "2" sorts after "12".

Numbers or text

What is on each side decides how two values are compared, and ApkPy reads that from the source.

  • Against text written out (name == "Ana"), it is a comparison of text.
  • Against a number written out (count > 3), of numbers.
  • Between two values that are not written out, it is a comparison of numbers when ApkPy knows either side is one: a number in the source, int(...), float(...), a name assigned from those, a sum of them, a range() index. Otherwise it is one of text, as Python compares two strings.

What somebody typed in a field is text until you convert it:

def check():
    low = int(first.get_value())
    high = int(second.get_value())
    if low < high:
        toast("In order")

Without int(), "2" < "12" is false -- in Python and on the phone alike.

Upgrading

  • Install 1.12.1 and build the app again. The fix is in the build: an APK made by an older version keeps the old answer until it is rebuilt.
  • An app that only compared against values written in the source is built into exactly the same files as before. Every example and every showcase app is.
  • An if between two values can now be true where it never was. Read what its branch does before you ship: it may be running for the first time.
  • A number compared with a value that may not be one -- a field left empty -- reads that value as a number, as if qty.get_value() > 5: always did, and an empty field stops the app there. Test for "" first.

How it was checked

Twenty conditions were built, run in Java, and compared with what Python answers for the same values: 1.12.0 gets eight of them wrong, 1.12.1 none. Every example app was built by both versions and the files compared: no difference. The package was then installed from its wheel into an empty environment and used to build an app that makes one sentence out of seven comparisons. On a Xiaomi running Android 16 the sentence was the one Python gives, and two fields holding the same word were found equal.

The complete list is in the changelog.