Pelokalan
Python ID · using__android.po Bahasa Indonesia
id en
Sign in
Project
History
Text
PO Module
All ▾
This file belongs to @irvan: you can only read it and join its discussions.
Source text — English
Translation — Bahasa Indonesia
Using Python on Android
Pakai Python di Android
Python on Android is unlike Python on desktop platforms. On a desktop platform, Python is generally installed as a system resource that can be used by any user of that computer. Users then interact with Python by running a :program:`python` executable and entering commands at an interactive prompt, or by running a Python script.
Python di Android berbeda dengan Python di platform desktop. Di platform desktop, Python umumnya diinstal sebagai sumber daya sistem yang dapat digunakan oleh pengguna mana pun dari komputer tersebut. Pengguna kemudian berinteraksi dengan Python dengan menjalankan executable :program:`python` dan memasukkan perintah di prompt interaktif, atau dengan menjalankan skrip Python.
On Android, there is no concept of installing as a system resource. The only unit of software distribution is an "app". There is also no console where you could run a :program:`python` executable, or interact with a Python REPL.
Di Android, tidak ada konsep menginstal sebagai sumber daya sistem. Satu-satunya unit distribusi perangkat lunak adalah "aplikasi". Tidak ada konsol di mana Anda dapat menjalankan eksekusi :program:`python`, atau berinteraksi dengan REPL Python.
As a result, the only way you can use Python on Android is in embedded mode – that is, by writing a native Android application, embedding a Python interpreter using ``libpython``, and invoking Python code using the :ref:`Python embedding API <embedding>`. The full Python interpreter, the standard library, and all your Python code is then packaged into your app for its own private use.
AI needs review
The Python standard library has some notable omissions and restrictions on Android. See the :ref:`API availability guide <mobile-availability>` for details.
Pustaka standar Python memiliki beberapa pengecualian dan pembatasan yang signifikan di Android. Lihat :ref:`panduan ketersediaan API <mobile-availability>` untuk detail.
AI needs review
Adding Python to an Android app
Menambahkan Python ke aplikasi Android
AI needs review
Most app developers should use one of the following tools, which will provide a much easier experience:
Sebagian besar pengembang aplikasi harus menggunakan salah satu alat berikut, yang akan memberikan pengalaman yang jauh lebih mudah:
AI needs review
`Briefcase <https://briefcase.beeware.org>`__, from the BeeWare project
`Briefcase <https://briefcase.beeware.org>`__, dari proyek BeeWare
AI needs review
`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project
`Buildozer <https://buildozer.readthedocs.io>`__, dari proyek Kivy
AI needs review
`Chaquopy <https://chaquo.com/chaquopy>`__
`Chaquopy <https://chaquo.com/chaquopy>`__
AI needs review
`Flet <https://flet.dev/>`__
`Flet <https://flet.dev/>`__
AI needs review
`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__
`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__
AI needs review
`Termux <https://termux.dev/en/>`__
`Termux <https://termux.dev/en/>`__
AI needs review
If you're sure you want to do all of this manually, read on. You can use the :source:`testbed app <Platforms/Android/testbed>` as a guide; each step below contains a link to the relevant file.
Jika Anda yakin ingin melakukan semua ini secara manual, baca terus. Anda dapat menggunakan :source:`aplikasi testbed <Platforms/Android/testbed>` sebagai panduan; setiap langkah di bawah ini berisi tautan ke file yang relevan.
AI needs review
First, acquire a build of Python for Android:
Pertama, dapatkan pembangunan Python untuk Android:
AI needs review
The easiest way is to download an Android release from `python.org <https://www.python.org/downloads/android/>`__. The ``prefix`` directory mentioned below is at the top level of the package.
Cara termudah adalah mengunduh rilis Android dari `python.org <https://www.python.org/downloads/android/>`__. Direktori ``prefix`` yang disebutkan di bawah ini berada di tingkat atas paket.
AI needs review
Or if you want to build it yourself, follow the instructions in :source:`Platforms/Android/README.md`. The ``prefix`` directory will be created under :samp:`cross-build/{HOST}`.
Atau jika Anda ingin membangunnya sendiri, ikuti instruksi di :source:`Platforms/Android/README.md`. Direktori ``prefix`` akan dibuat di bawah :samp:`cross-build/{HOST}`.
AI needs review
Add code to your :source:`build.gradle <Platforms/Android/testbed/app/build.gradle.kts>` file to copy the following items into your project. All except your own Python code can be copied from ``prefix/lib``:
Tambahkan kode ke file :source:`build.gradle <Platforms/Android/testbed/app/build.gradle.kts>` Anda untuk menyalin item berikut ke dalam proyek Anda. Semua kecuali kode Python Anda sendiri dapat disalin dari ``prefix/lib``:
AI needs review
In your JNI libraries:
Di pustaka JNI Anda:
AI needs review
``libpython*.*.so``
``libpython*.*.so``
AI needs review
``lib*_python.so`` (external libraries such as OpenSSL)
``lib*_python.so`` (pustaka eksternal seperti OpenSSL)
AI needs review
In your assets:
Di aset Anda:
AI needs review
``python*.*`` (the Python standard library)
``python*.*`` (pustaka standar Python)
AI needs review
``python*.*/site-packages`` (your own Python code)
``python*.*/site-packages`` (kode Python Anda sendiri)
AI needs review
Add code to your app to :source:`extract the assets to the filesystem <Platforms/Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt>`.
Tambahkan kode ke aplikasi Anda untuk :source:`mengekstrak aset ke sistem file <Platforms/Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt>`.
AI needs review
Add code to your app to :source:`start Python in embedded mode <Platforms/Android/testbed/app/src/main/c/main_activity.c>`. This will need to be C code called via JNI.
Tambahkan kode ke aplikasi Anda untuk :source:`memulai Python dalam mode tertanam <Platforms/Android/testbed/app/src/main/c/main_activity.c>`. Ini akan membutuhkan kode C yang dipanggil melalui JNI.
AI needs review
Building a Python package for Android
Membangun paket Python untuk Android
AI needs review
Python packages can be built for Android as wheels and released on PyPI. The recommended tool for doing this is `cibuildwheel <https://cibuildwheel.pypa.io/en/stable/platforms/#android>`__, which automates all the details of setting up a cross-compilation environment, building the wheel, and testing it on an emulator.
Paket Python dapat dibangun untuk Android sebagai roda dan dirilis di PyPI. Alat yang direkomendasikan untuk melakukan ini adalah `cibuildwheel <https://cibuildwheel.pypa.io/en/stable/platforms/#android>`__, yang mengotomatiskan semua detail pengaturan lingkungan cross-compilation, membangun roda, dan mengujinya di emulator.
Select an entry in the list to start translating.

⌨ Keyboard shortcuts

Saving

Ctrl+Enter
Save and go to the next entry. If the entry is fuzzy, the flag is cleared too (green button).
Ctrl+Shift+Enter
Save and go on, keeping the fuzzy flag.
Ctrl+U
Toggle the fuzzy flag.
Ctrl+B
Copy the source text into the translation box.
Ctrl+Shift+A
Translate this entry with AI (when AI is set up).

Moving around

↑ / ↓
Previous / next entry, also from the translation box. In multi-line text, from the first / last line.
Ctrl+↑ / ↓
Previous / next entry from anywhere.
Ctrl+F
Go to the search box.
Esc
Close a dialog, menu or thesaurus suggestions.
?
Show this help (outside text boxes).

Editing

Select a word
Select a word or phrase in the translation box to see synonyms; click one to replace it.
Click a glossary term
Insert the term's translation at the cursor.
Ctrl+Enter in a comment
Send a discussion comment.

📌 Context of module using__android

This context is shared by all project members and tied to the module using__android. It also helps AI translate more accurately.

No context for this module yet.