diff --git a/testapps/on_device_unit_tests/test_app/main.py b/testapps/on_device_unit_tests/test_app/main.py index d0fa34e97d..48bf0dc33d 100644 --- a/testapps/on_device_unit_tests/test_app/main.py +++ b/testapps/on_device_unit_tests/test_app/main.py @@ -85,10 +85,15 @@ app_flask.TESTS_TO_PERFORM = tests_to_perform print('Current directory is ', realpath(curdir)) - if realpath(curdir).startswith('/data'): - app_flask.app.run(debug=False) - else: - app_flask.app.run(debug=True) + flask_debug = not realpath(curdir).startswith('/data') + + # Flask is run non-threaded since it tries to resolve app classes + # through pyjnius from request handlers. That doesn't work since the + # JNI ends up using the Java system class loader in new native + # threads. + # + # https://github.com/kivy/python-for-android/issues/2533 + app_flask.app.run(threaded=False, debug=flask_debug) else: # we don't have kivy or flask in our # requirements, so we run unittests in terminal