Skip to content

Commit 03eb796

Browse files
committed
Fix python2 for webview
new env var ANDROID_UNPACK to target a folder '/data/data/<app>/files' and for sdl2 that + '/app' to get libpymodules.so
1 parent 421cab2 commit 03eb796

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonActivity.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ protected void onPostExecute(String result) {
131131
// private data if we do not.
132132
mActivity.finishLoad();
133133

134-
// finishLoad called setContentView with the SDL view, which
135-
// removed the loading screen. However, we still need it to
136-
// show until the app is ready to render, so pop it back up
137-
// on top of the SDL view.
138-
mActivity.showLoadingScreen();
139-
140134
String app_root_dir = getAppRoot();
141135
if (getIntent() != null && getIntent().getAction() != null &&
142136
getIntent().getAction().equals("org.kivy.LAUNCH")) {
@@ -172,6 +166,7 @@ protected void onPostExecute(String result) {
172166
String mFilesDirectory = mActivity.getFilesDir().getAbsolutePath();
173167
Log.v(TAG, "Setting env vars for start.c and Python to use");
174168
SDLActivity.nativeSetEnv("ANDROID_PRIVATE", mFilesDirectory);
169+
SDLActivity.nativeSetEnv("ANDROID_UNPACK", mFilesDirectory + "/app");
175170
SDLActivity.nativeSetEnv("PYTHONHOME", app_root_dir);
176171
SDLActivity.nativeSetEnv("PYTHONPATH", app_root_dir + ":" + app_root_dir + "/lib");
177172
SDLActivity.nativeSetEnv("PYTHONOPTIMIZE", "2");

pythonforandroid/recipes/python2/patches/custom-loader.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
+
1818
+ /* Ensure we have access to libpymodules. */
1919
+ if (libpymodules == -1) {
20-
+ printf("ANDROID_APP_PATH = %s\n", getenv("ANDROID_APP_PATH"));
21-
+ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_APP_PATH"));
20+
+ printf("ANDROID_UNPACK = %s\n", getenv("ANDROID_UNPACK"));
21+
+ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_UNPACK"));
2222
+ libpymodules = dlopen(pathbuf, RTLD_NOW);
2323
+
2424
+ if (libpymodules == NULL) {

0 commit comments

Comments
 (0)