mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 04:31:26 +02:00
Override getMainSharedObject()
This theoretically allows LOVE libs not to be extracted in Marshmallow and later by utilizing extractNativeLibs=false. However this is left to users (developer) to decide whetever to use this or not.
This commit is contained in:
@@ -45,14 +45,30 @@ public class GameActivity extends SDLActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getLibraries() {
|
protected String[] getLibraries() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"c++_shared",
|
"c++_shared",
|
||||||
"mpg123",
|
"mpg123",
|
||||||
"openal",
|
"openal",
|
||||||
"hidapi",
|
"hidapi",
|
||||||
"love",
|
"love",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMainSharedObject() {
|
||||||
|
String[] libs = getLibraries();
|
||||||
|
String libname = "lib" + libs[libs.length - 1] + ".so";
|
||||||
|
|
||||||
|
// Since Lollipop, you can simply pass "libname.so" to dlopen
|
||||||
|
// and it will resolve correct paths and load correct library.
|
||||||
|
// This is mandatory for extractNativeLibs=false support in
|
||||||
|
// Marshmallow.
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= 21) {
|
||||||
|
return libname;
|
||||||
|
} else {
|
||||||
|
return getContext().getApplicationInfo().nativeLibraryDir + "/" + libname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.d("GameActivity", "started");
|
Log.d("GameActivity", "started");
|
||||||
|
|||||||
Reference in New Issue
Block a user