/usr/share/doc/renpy/html/android-packaging.html is in renpy-doc 6.15.7-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Building Android Applications — Ren'Py Documentation</title>
<link rel="stylesheet" href="_static/screen.css" type="text/css" media="screen, projection"/>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="screen, projection"/>
<![endif]-->
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '6.15.6',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ren'Py Documentation" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<div class="container">
<div class="span4">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Building Android Applications</a><ul>
<li><a class="reference internal" href="#host-platform-support">Host Platform Support</a></li>
<li><a class="reference internal" href="#step-1-installing-pgs4a-and-its-dependencies">Step 1: Installing RAPT and its Dependencies</a></li>
<li><a class="reference internal" href="#aside-running-android-py">Aside: Running android.py</a></li>
<li><a class="reference internal" href="#step-2-set-up-the-android-sdk-and-development-environment">Step 2: Set up the Android SDK and Development Environment</a></li>
<li><a class="reference internal" href="#step-3-configure-your-game">Step 3: Configure Your Game</a></li>
<li><a class="reference internal" href="#step-4-build-and-install-the-package">Step 4: Build and Install the Package</a></li>
<li><a class="reference internal" href="#viewing-debug-output">Viewing Debug Output</a></li>
<li><a class="reference internal" href="#troubleshooting-and-support">Troubleshooting and Support</a></li>
<li><a class="reference internal" href="#expansion-apks">Expansion APKs</a></li>
</ul>
</li>
</ul>
<h4>Search</h4>
<div id="cse-search-form" style="width: 100%;"></div>
<div class="copydata">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
<br>
</div>
</div>
</div>
</div>
<div class="document span20 last">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="building-android-applications">
<h1>Building Android Applications<a class="headerlink" href="#building-android-applications" title="Permalink to this headline">¶</a></h1>
<p>RAPT contains tools that help you take a packaging-centric approach
to Android game development. In this approach, you will use a PC to
build an Android package and upload it to your device. You can then
run the game like any Android application. When it works correctly,
you can upload the package you make to the Android Market or other app
stores.</p>
<p>Building your first package takes four steps:</p>
<ol class="arabic simple">
<li>Download and install RAPT, Python 2.7, the Java Development Kit,
and Android USB Drivers (scroll down for links).</li>
<li>Use the <tt class="docutils literal"><span class="pre">android.py</span> <span class="pre">installsdk</span></tt> command to install the Android SDK and
set up your development environment.</li>
<li>Use the <tt class="docutils literal"><span class="pre">android.py</span> <span class="pre">configure</span></tt> command to configure
Android-specific settings in your game.</li>
<li>Use the <tt class="docutils literal"><span class="pre">android.py</span> <span class="pre">build</span></tt> command to build a package, and to
install the package on your device.</li>
</ol>
<p>Once you've finished these four steps, you'll have a runnable Android
package. You'll only need to run step 3 when you decide to make changes to your
game's configuration or when configuring a new game entirely; you'll run step
4 most often, whenever you need to make a new build of your game.</p>
<div class="section" id="host-platform-support">
<h2>Host Platform Support<a class="headerlink" href="#host-platform-support" title="Permalink to this headline">¶</a></h2>
<p>We've tested RAPT on Linux and Windows computers. While it should
work on Mac OS X, we haven't tested it there, so there may be problems
encountered. The examples we give will be for Linux and Windows.</p>
<p>The RAPT tools are command-line based. We will try to assist you with
examples to familiarize you with the command line on Windows.</p>
</div>
<div class="section" id="step-1-installing-pgs4a-and-its-dependencies">
<h2>Step 1: Installing RAPT and its Dependencies<a class="headerlink" href="#step-1-installing-pgs4a-and-its-dependencies" title="Permalink to this headline">¶</a></h2>
<p>There are four things you may need to manually download and install
before you can run RAPT:</p>
<p><strong>Java Development Kit.</strong>
The Java Development Kit (JDK) contains several tools that are used by
RAPT, including the tools used to generate keys and sign
packages. It can be downloaded from:</p>
<blockquote>
<div><a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a></div></blockquote>
<p>Please note that the developer-focused JDK is different from the
user-focused JRE, and you'll need the JDK to create Android packages.</p>
<p><strong>Python 2.7.</strong>
Python 2.7 is required to run the android.py script that's
included with RAPT. It can be downloaded from:</p>
<blockquote>
<div><a class="reference external" href="http://python.org/download/releases/2.7.2/">http://python.org/download/releases/2.7.2/</a></div></blockquote>
<p>RAPT is not compatible with Python 3 at this time.</p>
<p><strong>Android Device Drivers.</strong>
On Windows, you may want to install a device driver to access
your device, although this is not necessary. Links to android device drivers can be found at:</p>
<blockquote>
<div><a class="reference external" href="http://developer.android.com/sdk/oem-usb.html">http://developer.android.com/sdk/oem-usb.html</a></div></blockquote>
<p>On Linux or OS X, you won't need a device driver. If you can't access
your device, you may need to read:</p>
<blockquote>
<div><a class="reference external" href="http://developer.android.com/guide/developing/device.html#setting-up">http://developer.android.com/guide/developing/device.html#setting-up</a></div></blockquote>
<p>However, modern versions of Linux and OS X should just work.</p>
<p><strong>RAPT Itself.</strong> The latest version of RAPT can be downloaded from:</p>
<blockquote>
<div><a class="reference external" href="http://www.renpy.org/dl/android/">http://www.renpy.org/dl/android/</a></div></blockquote>
<p>Once RAPT has been downloaded, you should extract it using an
archive program. The directory contained in that archive is what we
will refer to as the RAPT directory.</p>
</div>
<div class="section" id="aside-running-android-py">
<h2>Aside: Running android.py<a class="headerlink" href="#aside-running-android-py" title="Permalink to this headline">¶</a></h2>
<p>In this documentation, we'll ask you to run the <tt class="docutils literal"><span class="pre">android.py</span></tt>
command. The technique we use to run this varies based on the system
you're on.</p>
<p>In all cases, you should run <tt class="docutils literal"><span class="pre">android.py</span></tt> from within the RAPT
directory. (That is, the directory containing <tt class="docutils literal"><span class="pre">android.py</span></tt> itself.)</p>
<p>On Windows, to do this, you will need to open up the command line by pressing
and holding down the Windows key and 'R'. In the small window that pops up
write "cmd" and press Enter. This should bring up the command line.</p>
<p>To run the command from within the RAPT directory you need to navigate to it
from the command line. Find out where you extracted RAPT and copy the path
from Explorer (just click in the address bar so the path turns blue and
press Ctrl+c). In the command prompt, write <tt class="docutils literal"><span class="pre">cd</span></tt> then a space, a
double-quote, paste the path you just copied from Explorer (right click and
choose <tt class="docutils literal"><span class="pre">paste</span></tt>), then another double-quote.</p>
<p>Let's assume you extracted RAPT to C:\tools\RAPT. In the command line write:</p>
<div class="highlight-none"><div class="highlight"><pre>cd "C:\tools\RAPT"
</pre></div>
</div>
<p>Now you're within the RAPT directory.</p>
<p>On Windows, if the .py extension is registered to Python 2.7, you then can
just run:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py test
</pre></div>
</div>
<p>If you don't know what the above means or you don't want to do it, you
will have to add the full path to Python to each command in
the following steps of this guide beginning with 'android.py'. If you
installed Python to the default location, the above command would become:</p>
<div class="highlight-none"><div class="highlight"><pre>C:\python27\python.exe android.py test
</pre></div>
</div>
<p>If you installed Python to a different location, then find your Python install
in Explorer, click in the address bar and copy the path, then replace
<tt class="docutils literal"><span class="pre">C:\python27</span></tt> with the path you copied instead - leaving <tt class="docutils literal"><span class="pre">\python.exe</span></tt> on the</p>
<p>end. So if your Python install is in <tt class="docutils literal"><span class="pre">C:\tools\python</span></tt>, you would type:</p>
<div class="highlight-none"><div class="highlight"><pre>C:\tools\python\python.exe android.py test
</pre></div>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>If the path to Python that you copied has any spaces in - for example, if you had installed it in the
<tt class="docutils literal"><span class="pre">Program</span> <span class="pre">Files</span></tt> directory - you will need to put double quotes at the beginning of the whole
command and just after <tt class="docutils literal"><span class="pre">python.exe</span></tt>:</p>
<div class="last highlight-none"><div class="highlight"><pre>"C:\Program Files\Python\python.exe" android.py test
</pre></div>
</div>
</div>
<p>On Linux, you may need to prefix the command with the current
directory:</p>
<div class="highlight-none"><div class="highlight"><pre>./android.py test
</pre></div>
</div>
<p>For the rest of this documentation, we'll just use <tt class="docutils literal"><span class="pre">android.py</span></tt> - if you had to include the path
to Python in the example above, you will need to do the same thing every time you see <tt class="docutils literal"><span class="pre">android.py</span></tt>
in these instructions.</p>
</div>
<div class="section" id="step-2-set-up-the-android-sdk-and-development-environment">
<h2>Step 2: Set up the Android SDK and Development Environment<a class="headerlink" href="#step-2-set-up-the-android-sdk-and-development-environment" title="Permalink to this headline">¶</a></h2>
<p>The next step is to set up the Android SDK and the rest of your
development environment. This step will:</p>
<ul class="simple">
<li>Check that the JDK is installed properly.</li>
<li>Install Apache Ant.</li>
<li>Install the Android SDK.</li>
<li>Use the Android SDK to install the appropriate development
packages.</li>
<li>Create a signing key that will be used to sign packages that are
placed on the market (android.keystore: this will be generated in the RAPT directory).</li>
</ul>
<p>This step requires Internet access.</p>
<p>To perform this step, run:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py installsdk
</pre></div>
</div>
<p>RAPT will report on what it's doing. It will also prompt you with
warnings about licenses, and ask if you want it to generate a key.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>The key generated by RAPT is created with a standard
passphrase. You should really use keytool to generate your own
signing keys.</p>
<blockquote>
<div><a class="reference external" href="http://docs.oracle.com/javase/1.3/docs/tooldocs/win32/keytool.html">http://docs.oracle.com/javase/1.3/docs/tooldocs/win32/keytool.html</a></div></blockquote>
<p class="last">At the very least, you should keep the android.keyring file in
a safe place. You should also back it up, because without the
key, you won't be able to upload the generated applications.</p>
</div>
<p>In the examples below, <tt class="docutils literal"><span class="pre">mygame</span></tt> is short for the path to the game
you're working on, relative to the current directory. When you make
your own game, you should change <tt class="docutils literal"><span class="pre">mygame</span></tt> to something else.
The easiest way to do this, of course, is to make a copy of your game's
directory inside the RAPT directory and then replace <tt class="docutils literal"><span class="pre">mygame</span></tt> in
the examples below with the name of your game's directory.</p>
</div>
<div class="section" id="step-3-configure-your-game">
<h2>Step 3: Configure Your Game<a class="headerlink" href="#step-3-configure-your-game" title="Permalink to this headline">¶</a></h2>
<p>Before building a package, you must give RAPT some information
about your game. You can do this with the following command:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py configure mygame
</pre></div>
</div>
<p>This will ask you a series of questions about your game, and store
that information in a file in the game directory.</p>
<p>If you need to change the information - for example, if you release a
new version of your game - you can re-run the configure command. Your
previous choices will be remembered.</p>
</div>
<div class="section" id="step-4-build-and-install-the-package">
<h2>Step 4: Build and Install the Package<a class="headerlink" href="#step-4-build-and-install-the-package" title="Permalink to this headline">¶</a></h2>
<p>Finally, you can build and install the package. This is done with a
command like:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py build mygame release install
</pre></div>
</div>
<p>This command will build a releasable version of your game, and then
install it on the connected device. Please look at the output of this
command to make sure it succeeds.</p>
<p>Once the game successfully installs, you can touch its icon in your
device's launcher to start it running.</p>
<p>If you'd rather just copy the game's apk file to your Android device manually, you can just run:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py build mygame release
</pre></div>
</div>
<p>Then navigate to the 'bin' directory inside RAPT and copy the file mygame-release.apk into your Android Device.
You will then need to find the .apk file in your Android device using your file application and open it to install the</p>
<p>game.</p>
<p>The build command passes the options after the game name to the ant
tool, which is responsible for creating the Android package. Other
commands are also possible - for a list, run:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py build mygame help
</pre></div>
</div>
</div>
<div class="section" id="viewing-debug-output">
<h2>Viewing Debug Output<a class="headerlink" href="#viewing-debug-output" title="Permalink to this headline">¶</a></h2>
<p>To view debug output from your application, run the logcat command:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py logcat
</pre></div>
</div>
<p>This command runs the <tt class="docutils literal"><span class="pre">adb</span> <span class="pre">logcat</span></tt> command in a mode that selects
only Python output.</p>
</div>
<div class="section" id="troubleshooting-and-support">
<h2>Troubleshooting and Support<a class="headerlink" href="#troubleshooting-and-support" title="Permalink to this headline">¶</a></h2>
<p>Here's a list of errors that you might encounter and possible solutions:</p>
<p>When trying to run:</p>
<div class="highlight-none"><div class="highlight"><pre>android.py test
</pre></div>
</div>
<p>After having associated .py files with Python 2.7, if you get:</p>
<div class="highlight-none"><div class="highlight"><pre>Traceback (most recent call last):
File "C:\Visual Novels and Games\rapt-6.13.11.0\android.py", line 9, in <module>
import subprocess
File "C:\Python27\lib\subprocess.py", line 444, in <module>
from _subprocess import CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP
ImportError: cannot import name CREATE_NEW_PROCESS_GROUP
</pre></div>
</div>
<p>This may be related to having more than one version of Python installed on your system.
Try running android.py with the full path to Python, e.g.:</p>
<div class="highlight-none"><div class="highlight"><pre>C:\python27\python.exe android.py test
</pre></div>
</div>
<p>(If this works, then you will need to include the full path to Python in every command,
as if you didn't have the file type associated.)</p>
<p>If while downloading Apache Ant you get:</p>
<div class="highlight-none"><div class="highlight"><pre>IOError: [Errno socket error] [Errno 10054] An existing connection was forcibly
closed by the remote host
</pre></div>
</div>
<p>Just try installing the sdk again with the same command.</p>
<p>If while configuring your game you get something like:</p>
<div class="highlight-none"><div class="highlight"><pre>Tag <manifest> attribute package has invalid character '-'.
</pre></div>
</div>
<p>You may have inserted an invalid character in the package name you used during
configuration (in this case a hyphen '-'). You'll have to use a different
package name which does not contain anything other than letters and dots.</p>
<p>If while configuring you get something like:</p>
<div class="highlight-none"><div class="highlight"><pre>Traceback (most recent call last):
File "android.py", line 66, in <module>
main()
File "android.py", line 44, in main
configure.configure(iface, directory)
File "buildlib\configure.py", line 108, in configure
config.save(directory)
File "buildlib\configure.py", line 30, in save
with file(os.path.join(directory, ".android.json"), "w") as f:
IOError: [Errno 2] No such file or directory: 'mygame\\.android.json'
</pre></div>
</div>
<p>You should check whether you specified the correct path to your game directory. The easiest
way to be sure is to put your game's directory inside the RAPT directory, and simply supply
the name of your game's directory. (If your game's directory name has spaces, you may need
to surround it with double quotes.)</p>
<p>If building your game gives you an error like:</p>
<blockquote>
<div>Error: Target id android-8 is not valid. Use 'android list targets' to get the target ids</div></blockquote>
<p>You might want to check whether you have Android 2.2 (API 8) in the Android SDK manager.
You can run it by navigating to the android-sdk/tools directory inside the RAPT directory
and run android.bat.</p>
<img alt="_images/android_sdk_manager_001.jpg" class="align-center" src="_images/android_sdk_manager_001.jpg" />
<p>If Android 2.2 (API 8) is missing like in the above image, click 'Updates' and then 'Install Updates'.</p>
<p>Once the updates are installed, make sure Android 2.2 (API 8) and SDK platform are ticked:</p>
<img alt="_images/android_sdk_manager_005.jpg" class="align-center" src="_images/android_sdk_manager_005.jpg" />
<p>And install the packages. Then, try building your game again.</p>
<p>If you still have questions or doubts you can try searching through or posting on the
RAPT thread over at the Lemmasoft forums:</p>
<blockquote>
<div><a class="reference external" href="http://lemmasoft.renai.us/forums/viewtopic.php?f=32&t=13987&hilit=rapt">http://lemmasoft.renai.us/forums/viewtopic.php?f=32&t=13987&hilit=rapt</a></div></blockquote>
</div>
<div class="section" id="expansion-apks">
<h2>Expansion APKs<a class="headerlink" href="#expansion-apks" title="Permalink to this headline">¶</a></h2>
<p>RAPT optionally supports the use of expansion APKs when used on a
device supporting Google Play. Please see:</p>
<blockquote>
<div><a class="reference external" href="http://developer.android.com/google/play/expansion-files.html">http://developer.android.com/google/play/expansion-files.html</a></div></blockquote>
<p>For information about expansion APKs work. Right now, only the
main expansion APK is supported, giving a 2GB limit.</p>
<p>When an APK is created, all game files will be placed in the
expansion APK. Ren'Py will transparently use these files.</p>
<p>RAPT will place the expansion APK on the device when installing
the APK package on the device. In normal operation, Google Play will
place the expansion APK on the device automatically.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en' });
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('012476843541036121001:gx3sqkoaxkm');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchboxOnly("http://www.google.com/cse?cx=012476843541036121001:gx3sqkoaxkm");
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
</body>
</html>
|