Skip to content

Commit 24831df

Browse files
committed
Merge pull request kivy#649 from kived/fix-libs-pre-kitkat
load python lib before main
2 parents a04d9d3 + 084ddec commit 24831df

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,29 @@ protected static String[] getLibraries() {
1414
"SDL2_image",
1515
"SDL2_mixer",
1616
"SDL2_ttf",
17+
"python2.7",
18+
"python3.5m",
1719
"main"
1820
};
1921
}
2022

2123
public static void loadLibraries(File filesDir) {
2224

2325
String filesDirPath = filesDir.getAbsolutePath();
26+
boolean skippedPython = false;
2427

2528
for (String lib : getLibraries()) {
26-
System.loadLibrary(lib);
29+
try {
30+
System.loadLibrary(lib);
31+
} catch(UnsatisfiedLinkError e) {
32+
if (lib.startsWith("python") && !skippedPython) {
33+
skippedPython = true;
34+
continue;
35+
}
36+
throw e;
37+
}
2738
}
2839

29-
try {
30-
System.loadLibrary("python2.7");
31-
} catch(UnsatisfiedLinkError e) {
32-
Log.v(TAG, "Failed to load libpython2.7");
33-
}
34-
35-
try {
36-
System.loadLibrary("python3.5m");
37-
} catch(UnsatisfiedLinkError e) {
38-
Log.v(TAG, "Failed to load libpython3.5m");
39-
}
40-
4140
try {
4241
System.load(filesDirPath + "/lib/python2.7/lib-dynload/_io.so");
4342
System.load(filesDirPath + "/lib/python2.7/lib-dynload/unicodedata.so");

0 commit comments

Comments
 (0)