Correctly copy APK fast

by Ricardo Fernández Serrata

Version 1 (July 18, 2021)

Download (24 downloads)

I've seen a lot of "APK extractors" that do this wrong, causing some APKs to fail to be extracted, and even poor execution performance. This flow will show you how to do it correctly and efficiently.

"pm path" is a command that returns A LIST of APK paths delimited by \n. Most apps only have 1 file, so the cmd returns 1 line that ends in \n. Some APKs like Chrome or AI Dungeon have multiple APKs in their installation directory. This cmd is equivalent to searching the install-dir and then listing all files contained in it that use the apk extension.

The minimum index of the 1st \n is 14, because each line starts with "package:/", ends in ".apk" and has (theoretically) at least 1 char in-between.

I said theoretically, because they have more than 1 char in general (the probability of a path having the same length as "package:/a.apk" is ridiculously low).

To avoid assumptions that could cause bugs on exceptional cases, an index of 14 is used, because it's the fastest & safest bare minimum (an index of 17 or 24 can be used for faster speed, but it's risky)

APK_list_CSV has "CSV" in its name because it's a "Character Separated Value" string (the separator is \n in this case)

4.5 average rating from 2 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Rate and review within the app in the Community section.