-
Notifications
You must be signed in to change notification settings - Fork 14
Step by step guide to create an Android application using PythonFMXBuilder
- Install and setup the Android SDK using the following wiki guide: https://github.com/Embarcadero/PythonFMXBuilder/wiki/Android-SDK-guide
- Install and setup the Java JDK using the following wiki guide: https://github.com/Embarcadero/PythonFMXBuilder/wiki/Open-JDK-guide
Now the environment to build an Android application is set
- Press on the New project in the Project explorer section. Enter the name of the Android app that you want to build here. I've set it to Frames here as we're using
Frame
component of DelphiFMX package:
- Add any supporting files that you use as part of your application's
main.py
code. One of the best practices is to take a modular approach in building your application. As per the modular approach, we can write all the implementation in another Python files and call them from the main application Python file. Here, I added theframes_implementation.py
file from our GitHub samples using right click on mouse>Add file;
- Then copy and paste your main application code to the
main.py
code editor space. Here, I copy-pasted theframes_init.py
from our GitHub samples;
- Press on the Project button here:
- It opens up a slider window from right to set up all the Project details.
- You can see the name of your application is already set in the Application Name and Package Name fields. In my case, it is Frames which we've set at starting:
- Provide the version information in the Version Info section. It depends upon your release schedule information.
- We're shipping 3 Python versions -
3.8
,3.9
, and3.10
as part of the PythonFMXBuilder release. They're compiled on Android-NDK to support Python code on an Android device. You can choose one of those versions in Python Version section. We also support building apps on both 32 (arm
) and 64 (aarch64) bit arm architectures.
- You can set the app icon and splash screen image using the Application Icons section. Based on the device screen sizes and screen densities, you need to choose the image size of your splash screen and icon. In my case, my phone supports
470*320
size splash screen and96*96
size icon.
Note: After setting all this Project options press on the Save button at the bottom.
We have an option to open up a pre-existing Python code file into the code editing space. Currently, we've only a capability of just a notepad. We've plans to support basic code editing functionalities in future releases. So, our current suggestion is to write and develop your application in any other code editor and open it using the File>Open menu on the Menu bar.
First, you need to activate USB Debugging in your phone. To do that;
- Open About Phone in your Settings, Open Version and press few times on the Build Number. It shows a message that "You're a developer now". * Then, open Developer Options and activate USB Debugging.
- Connect your phone to the computer using a USB cable. It asks you for permission in your phone to "Whether you want to allow USB Debugging on the connected computer?". Press Allow.
- Then reload the devices list and select your device using this button on the right top corner;
We're providing two options for the developers who build applications using PythonFMXBuilder:
-
Option 1: Build an Android application (
.apk
) file. You can share your.apk
file in your internal groups for reviews and validations. To do this, press on the Build button which generated.apk
file inout\Win64\Release\apps\icon_splash\bin
folder in my case.
- Option 2: Deploy and launch the application to your device directly using the Deploy button:
You'll see your application open up automatically as you Deploy it in your device
You can iteratively develop for changes in your app and deploy to build your desired application
Embarcadero Python-Dev Team