/py4android-vscode-extension

Develop android Hybrid App using python in vscode. 在vscode中使用Python直接开发android应用。

Primary LanguageJavaScriptApache License 2.0Apache-2.0

English  |  中文 



4d64c2fa3aacf65279663e51905653fc

fastdev-py4a-vscode-extension

Use some unconventional methods to develop Android apps in Python within VS Code. It is suitable for the rapid implementation of personal tools or prototypes and for personal learning purposes. Use it cautiously in production environments, and it cannot be published on app stores such as Google Play.

Features/Dependencies

  • There's no need to install Android Studio. You can directly use VS Code for development.
  • Requires Java Runtime Environment.
  • Currently, only Windows => apk (armv8) is supported.
  • No root permission is required. Use proot to enter the Debian environment to start the Python server program.
  • Python version 3.11 is used.
  • The UI is implemented using webview.
  • Use the upload component LuckSiege/PictureSelector

Usage

0. Ensure that Java Runtime has been installed.

image

1. Install the VSIX installation package in the releases.

2. Create a project folder and open it using VS Code.

3. Open the feature interface on the sidebar. For the first run, it is necessary to "Initialize Environment", and then click on "Create Project" at the top.

image

4. Use adb to connect to the device. Once the connection is successful, the device can be seen, and then click on "Build Install Run (Full Package)".

image

Related to the base APK

  • fastdev-py4a-base , After being packaged into an APK, it is used as a base unpacking program.
  • Some tools, including ssh/sftp/webtty , have been simply implemented using ppobox.

Other details

  • Use Apktool to unpack and repack APK.
  • Use AnotherTermShellPlugin-Android10Essentials to use the shell through proot on Android 10 and above without root permission.
  • Use flatbuffers as the communication protocol between Python and Java.
  • Use PictureSelector as the image selector.
  • Use the python image from arm64v8/python:3.11-slim-bookworm.

References