Skip to content

Commit 350eada

Browse files
committed
Added APK unpacking instructions
1 parent 599ed2e commit 350eada

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

doc/source/troubleshooting.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,51 @@ on `logcat
6969
<http://developer.android.com/intl/zh-cn/tools/help/logcat.html>`_ in
7070
particular.
7171

72+
Unpacking an APK
73+
----------------
74+
75+
It is sometimes useful to unpack a pacakged APK to see what is inside,
76+
especially when debugging python-for-android itself.
77+
78+
APKs are just zip files, so you can extract the contents easily::
79+
80+
unzip YourApk.apk
81+
82+
At the top level, this will always contain the same set of files::
83+
84+
$ ls
85+
AndroidManifest.xml classes.dex META-INF res
86+
assets lib PyonicPython2interpreter-0.9-debug.apk resources.arsc
87+
88+
The Python distribution is in the assets folder::
89+
90+
$ cd assets
91+
$ ls
92+
private.mp3
93+
94+
``private.mp3`` is actually a tarball containing all your packaged
95+
data, and the Python distribution. Extract it::
96+
97+
$ tar xf private.mp3
98+
99+
This will reveal all the Python-related files::
100+
101+
$ ls
102+
android_runnable.pyo include interpreter_subprocess main.kv pipinterface.kv settings.pyo
103+
assets __init__.pyo interpreterwrapper.pyo main.pyo pipinterface.pyo utils.pyo
104+
editor.kv interpreter.kv lib menu.kv private.mp3 widgets.pyo
105+
editor.pyo interpreter.pyo libpymodules.so menu.pyo settings.kv
106+
107+
Most of these files have been included by the user (in this case, they
108+
come from one of my own apps), the rest relate to the python
109+
distribution.
110+
111+
With Python 2, the Python installation can mostly be found in the
112+
``lib`` folder. With Python 3 (using the ``python3crystax`` recipe),
113+
the Python installation can be found in a folder named
114+
``crystax_python``.
115+
116+
72117
Common errors
73118
-------------
74119

0 commit comments

Comments
 (0)