|
1 | 1 | # Deploying on Android devices |
2 | 2 |
|
3 | | -Starting from release 20180723 you can deploy the UnrealEnginePython plugin on android devices (both for launching and for packaging). |
| 3 | +Starting from release 20180723 and engine 4.20 you can deploy the UnrealEnginePython plugin on android devices (both for launching and for packaging). |
4 | 4 |
|
5 | 5 | The python distribution is the one from the "Crystax NDK" project (https://www.crystax.net/android/ndk), but you do not need to download it as this repository |
6 | 6 | already contains the required shared libraries and headers as well as the the python standard lib compressed in a zip file: |
@@ -48,3 +48,22 @@ Now you can Launch your project over the Android device. |
48 | 48 | Before launching the UnrealEnginePython plugin will be built for the arm architecture, then an apk will be uploaded as well as your Content directory. If all goes wall you should see your Character auto-jumping in the Android device. |
49 | 49 |
|
50 | 50 | ## Packaging |
| 51 | + |
| 52 | +Packaging is a bit more complex as Unreal generates a fake .obb file along the .apk file. |
| 53 | + |
| 54 | +This .obb file is a simple .zip file containing the .pak file as well as your Scripts directory. As this is not a true android .obb file, we cannot mount it as a filesystem (using the android StorageManager api) so we need to treat it as a simple zip file. |
| 55 | + |
| 56 | +Lucky enough, python supports getting modules from a zip file, so just adding the .obb file to its modules search path will be more than enough (the UnrealEnginePython plugin does it automatically). |
| 57 | + |
| 58 | +The problem is that python does not support zip files into zip files (stdlib.zip is into the .obb file) so to allow packaged games to run we need to decompress stdlib.zip in the Scripts directory. This will result in our Scripts directory being clobbered with additional .py files (feel free to propose better solutions). |
| 59 | + |
| 60 | +Once the stdlib.zip file is decompressed you can package your project and upload it to the device. |
| 61 | + |
| 62 | +## Note |
| 63 | + |
| 64 | +Try to use python 3.5 even for the editor, otherwise the files extracted from stdlib.zip could cause problems (the SRE exception is the first you should get in such a case) |
| 65 | + |
| 66 | +Python 3.6, albeit not tested, should work. |
| 67 | + |
| 68 | +Any python 3 release built from the Crystax NDK should work too. Just compile it, copy the related files into the repository android/ directory and change https://github.com/20tab/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython_APL.xml and |
| 69 | +https://github.com/20tab/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython.Build.cs accordingly. |
0 commit comments