diff --git a/app_src/main.py b/app_src/main.py index 8e6933a..a4d0ef9 100644 --- a/app_src/main.py +++ b/app_src/main.py @@ -1,3 +1,6 @@ +from utils.helper import write_logs_to_file +write_logs_to_file() + import logging import traceback @@ -167,7 +170,7 @@ def set_intent_for_file_operation_class(activity_id, some_int, intent): # Fix for permission Error when choosing from Internal Storage section Android FileExplorer self.file_operation.intent = intent except Exception as error_getting_path: - app_logger.exception("error_getting_path", error_getting_path) + app_logger.exception(f"error_getting_path: {error_getting_path}") activity.bind( on_activity_result=set_intent_for_file_operation_class) diff --git a/app_src/utils/helper.py b/app_src/utils/helper.py index 8c65363..eddf514 100644 --- a/app_src/utils/helper.py +++ b/app_src/utils/helper.py @@ -89,12 +89,20 @@ def fix_log_to_terminal_on_android(message): Log.d("python", message) + + +def app_external_storage_path(): + context = get_python_activity_context() + + ext_dir = context.getExternalFilesDir(None) + return ext_dir.getAbsolutePath() if ext_dir else appFolder() + def write_logs_to_file(log_folder_name="logs", file_name="all_output1.txt"): if DEV or not on_android_platform(): return try: - log_folder = os.path.join(appFolder(), log_folder_name) + log_folder = os.path.join(app_external_storage_path(), log_folder_name) makeFolder(log_folder) # Log file path @@ -396,4 +404,4 @@ def is_running_debug_build(): ) != 0 except Exception as e: print(f"Error checking debuggable status: {e}") - return False \ No newline at end of file + return False diff --git a/buildozer.spec b/buildozer.spec index f80db2f..fe856c6 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -21,7 +21,7 @@ source.include_exts = py,png,jpg,kv,atlas,ttf,json,xml,wav source.exclude_dirs = bin, venv,lab, worked, __pycache__, .idea, dist, for-download,laner-linux, .filereader, wallpapers -requirements = python3,kivy,https://github.com/kivymd/KivyMD/archive/master.zip,python-osc,https://github.com/kivy/plyer/archive/master.zip,materialyoucolor,asynckivy,asyncgui,pyjnius, docutils,netifaces,filetype,requests_toolbelt,websockets,android-widgets, https://github.com/Fector101/android_notify/archive/main.zip +requirements = python3,kivy,https://github.com/kivymd/KivyMD/archive/master.zip,python-osc,https://github.com/kivy/plyer/archive/master.zip,materialyoucolor>=3.0.3,asynckivy,asyncgui,pyjnius, docutils,netifaces,filetype,requests_toolbelt,websockets,android-widgets, https://github.com/Fector101/android_notify/archive/main.zip services = Wallpapercarousel:./android/services/wallpaper.py:foreground:foregroundServiceType=specialUse # Shorttask:./android/services/shorttask.py @@ -65,4 +65,4 @@ android.release_artifact = apk log_level = 2 warn_on_root = 1 -# Don't write inline comments \ No newline at end of file +# Don't write inline comments