Kivy: 導入安卓庫,僅在安卓設備情況下 - 图1
    © dotmodus

    由於語法渲染問題而影響閱讀體驗, 請移步博客閱讀~
    本文GitPage地址

    You may see error code below when you try to import android in your PC.

    1. Traceback (most recent call last):
    2. File "main.py", line 5, in <module>
    3. from android.permissions import request_permissions, Permission
    4. ModuleNotFoundError: No module named 'android'

    For solving this, you can import platform like below:

    1. from kivy.utils import platform
    2. if platform == "android":
    3. from android.permissions import request_permissions, Permission
    4. request_permissions([Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE])

    Enjoy~

    本文由Python腳本GitHub/語雀自動更新

    由於語法渲染問題而影響閱讀體驗, 請移步博客閱讀~
    本文GitPage地址

    GitHub: Karobben
    Blog:Karobben
    BiliBili:史上最不正經的生物狗