Skip to content

Commit bdef07e

Browse files
committed
Remove the libraries loading mechanism
Because we have proved that we don't need that (we take care of that in gradle configuration)...so...there is no need to keep the loading mechanism to only load a single library `libmain.so` which is the only one we need to load...all others will be loaded automatically by the android os library system. Note: This changes affects bootstraps: sdl2, webview and service_only
1 parent ddb46f6 commit bdef07e

File tree

7 files changed

+4
-239
lines changed

7 files changed

+4
-239
lines changed

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonService.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import android.os.Process;
1515
import java.io.File;
1616

17-
import org.kivy.android.PythonUtil;
18-
1917
import org.renpy.android.Hardware;
2018

2119

@@ -142,9 +140,7 @@ public void onTaskRemoved(Intent rootIntent) {
142140

143141
@Override
144142
public void run(){
145-
String app_root = getFilesDir().getAbsolutePath() + "/app";
146-
File app_root_file = new File(app_root);
147-
PythonUtil.loadLibraries(app_root_file);
143+
System.loadLibrary("main");
148144
this.mService = this;
149145
nativeStart(
150146
androidPrivate, androidArgument,

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 0 additions & 82 deletions
This file was deleted.

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
import org.libsdl.app.SDLActivity;
3838

39-
import org.kivy.android.PythonUtil;
4039
import org.kivy.android.launcher.Project;
4140

4241
import org.renpy.android.ResourceManager;
@@ -73,12 +72,6 @@ protected void onCreate(Bundle savedInstanceState) {
7372
new UnpackFilesTask().execute(getAppRoot());
7473
}
7574

76-
public void loadLibraries() {
77-
String app_root = new String(getAppRoot());
78-
File app_root_file = new File(app_root);
79-
PythonUtil.loadLibraries(app_root_file);
80-
}
81-
8275
public void recursiveDelete(File f) {
8376
if (f.isDirectory()) {
8477
for (File r : f.listFiles()) {

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

Lines changed: 0 additions & 100 deletions
This file was deleted.

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/libsdl/app/SDLActivity.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,6 @@ public class SDLActivity extends Activity {
5858
// Audio
5959
protected static AudioTrack mAudioTrack;
6060

61-
/**
62-
* This method is called by SDL before loading the native shared libraries.
63-
* It can be overridden to provide names of shared libraries to be loaded.
64-
* The default implementation returns the defaults. It never returns null.
65-
* An array returned by a new implementation must at least contain "SDL2".
66-
* Also keep in mind that the order the libraries are loaded may matter.
67-
* @return names of shared libraries to be loaded (e.g. "SDL2", "main").
68-
*/
69-
protected String[] getLibraries() {
70-
return new String[] {
71-
"SDL2",
72-
// "SDL2_image",
73-
// "SDL2_mixer",
74-
// "SDL2_net",
75-
// "SDL2_ttf",
76-
"main"
77-
};
78-
}
79-
80-
// Load the .so
81-
public void loadLibraries() {
82-
for (String lib : getLibraries()) {
83-
System.loadLibrary(lib);
84-
}
85-
}
86-
8761
/**
8862
* This method is called by SDL before starting the native application thread.
8963
* It can be overridden to provide the arguments after the application name.
@@ -130,7 +104,7 @@ protected void finishLoad() {
130104
// Load shared libraries
131105
String errorMsgBrokenLib = "";
132106
try {
133-
loadLibraries();
107+
System.loadLibrary("main");
134108
} catch(UnsatisfiedLinkError e) {
135109
System.err.println(e.getMessage());
136110
mBrokenLibraries = true;

pythonforandroid/bootstraps/service_only/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
import android.webkit.WebViewClient;
4747
import android.webkit.WebView;
4848

49-
import org.kivy.android.PythonUtil;
50-
5149
import org.renpy.android.ResourceManager;
5250
import org.renpy.android.AssetExtract;
5351

@@ -106,7 +104,7 @@ protected void onCreate(Bundle savedInstanceState) {
106104
// Load shared libraries
107105
String errorMsgBrokenLib = "";
108106
try {
109-
loadLibraries();
107+
System.loadLibrary("main");
110108
} catch(UnsatisfiedLinkError e) {
111109
System.err.println(e.getMessage());
112110
mBrokenLibraries = true;
@@ -181,12 +179,6 @@ public void onDestroy() {
181179
android.os.Process.killProcess(android.os.Process.myPid());
182180
}
183181

184-
public void loadLibraries() {
185-
String app_root = new String(getAppRoot());
186-
File app_root_file = new File(app_root);
187-
PythonUtil.loadLibraries(app_root_file);
188-
}
189-
190182
public void recursiveDelete(File f) {
191183
if (f.isDirectory()) {
192184
for (File r : f.listFiles()) {

pythonforandroid/bootstraps/webview/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
import android.webkit.WebViewClient;
4949
import android.webkit.WebView;
5050

51-
import org.kivy.android.PythonUtil;
52-
5351
import org.kivy.android.WebViewLoader;
5452

5553
import org.renpy.android.ResourceManager;
@@ -115,7 +113,7 @@ protected void onCreate(Bundle savedInstanceState) {
115113
// Load shared libraries
116114
String errorMsgBrokenLib = "";
117115
try {
118-
loadLibraries();
116+
System.loadLibrary("main");
119117
} catch(UnsatisfiedLinkError e) {
120118
System.err.println(e.getMessage());
121119
mBrokenLibraries = true;
@@ -212,12 +210,6 @@ public void onDestroy() {
212210
android.os.Process.killProcess(android.os.Process.myPid());
213211
}
214212

215-
public void loadLibraries() {
216-
String app_root = new String(getAppRoot());
217-
File app_root_file = new File(app_root);
218-
PythonUtil.loadLibraries(app_root_file);
219-
}
220-
221213
public void recursiveDelete(File f) {
222214
if (f.isDirectory()) {
223215
for (File r : f.listFiles()) {

0 commit comments

Comments
 (0)